analytica-frontend-lib 1.0.83 → 1.0.85
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.js +163 -74
- package/dist/Accordation/index.js.map +1 -1
- package/dist/Accordation/index.mjs +163 -74
- package/dist/Accordation/index.mjs.map +1 -1
- package/dist/Alert/index.js +32 -32
- package/dist/Alert/index.js.map +1 -1
- package/dist/Alert/index.mjs +32 -32
- package/dist/Alert/index.mjs.map +1 -1
- package/dist/AlertDialog/index.js +13 -2
- package/dist/AlertDialog/index.js.map +1 -1
- package/dist/AlertDialog/index.mjs +13 -2
- package/dist/AlertDialog/index.mjs.map +1 -1
- package/dist/Alternative/index.js +86 -25
- package/dist/Alternative/index.js.map +1 -1
- package/dist/Alternative/index.mjs +86 -25
- package/dist/Alternative/index.mjs.map +1 -1
- package/dist/Badge/index.js +13 -4
- package/dist/Badge/index.js.map +1 -1
- package/dist/Badge/index.mjs +13 -4
- package/dist/Badge/index.mjs.map +1 -1
- package/dist/Button/index.js +10 -1
- package/dist/Button/index.js.map +1 -1
- package/dist/Button/index.mjs +8 -1
- package/dist/Button/index.mjs.map +1 -1
- package/dist/Calendar/index.js +11 -2
- package/dist/Calendar/index.js.map +1 -1
- package/dist/Calendar/index.mjs +11 -2
- package/dist/Calendar/index.mjs.map +1 -1
- package/dist/Card/index.js +154 -71
- package/dist/Card/index.js.map +1 -1
- package/dist/Card/index.mjs +154 -71
- package/dist/Card/index.mjs.map +1 -1
- package/dist/CheckBox/index.js +28 -5
- package/dist/CheckBox/index.js.map +1 -1
- package/dist/CheckBox/index.mjs +28 -5
- package/dist/CheckBox/index.mjs.map +1 -1
- package/dist/Chips/index.js +10 -1
- package/dist/Chips/index.js.map +1 -1
- package/dist/Chips/index.mjs +10 -1
- package/dist/Chips/index.mjs.map +1 -1
- package/dist/Divider/index.js +10 -1
- package/dist/Divider/index.js.map +1 -1
- package/dist/Divider/index.mjs +8 -1
- package/dist/Divider/index.mjs.map +1 -1
- package/dist/DropdownMenu/index.js +18 -22
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs +18 -22
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/IconButton/index.js +10 -1
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButton/index.mjs +10 -1
- package/dist/IconButton/index.mjs.map +1 -1
- package/dist/IconRoundedButton/index.js +10 -1
- package/dist/IconRoundedButton/index.js.map +1 -1
- package/dist/IconRoundedButton/index.mjs +8 -1
- package/dist/IconRoundedButton/index.mjs.map +1 -1
- package/dist/Menu/index.js +22 -10
- package/dist/Menu/index.js.map +1 -1
- package/dist/Menu/index.mjs +22 -10
- package/dist/Menu/index.mjs.map +1 -1
- package/dist/Modal/index.js +15 -1
- package/dist/Modal/index.js.map +1 -1
- package/dist/Modal/index.mjs +15 -1
- package/dist/Modal/index.mjs.map +1 -1
- package/dist/NavButton/index.js +10 -1
- package/dist/NavButton/index.js.map +1 -1
- package/dist/NavButton/index.mjs +10 -1
- package/dist/NavButton/index.mjs.map +1 -1
- package/dist/NotFound/index.js +13 -3
- package/dist/NotFound/index.js.map +1 -1
- package/dist/NotFound/index.mjs +13 -3
- package/dist/NotFound/index.mjs.map +1 -1
- package/dist/ProgressBar/index.js +63 -15
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ProgressBar/index.mjs +63 -15
- package/dist/ProgressBar/index.mjs.map +1 -1
- package/dist/ProgressCircle/index.js +34 -7
- package/dist/ProgressCircle/index.js.map +1 -1
- package/dist/ProgressCircle/index.mjs +34 -7
- package/dist/ProgressCircle/index.mjs.map +1 -1
- package/dist/Quiz/index.d.mts +25 -2
- package/dist/Quiz/index.d.ts +25 -2
- package/dist/Quiz/index.js +972 -260
- package/dist/Quiz/index.js.map +1 -1
- package/dist/Quiz/index.mjs +968 -261
- package/dist/Quiz/index.mjs.map +1 -1
- package/dist/Quiz/useQuizStore/index.d.mts +44 -12
- package/dist/Quiz/useQuizStore/index.d.ts +44 -12
- package/dist/Quiz/useQuizStore/index.js +206 -85
- package/dist/Quiz/useQuizStore/index.js.map +1 -1
- package/dist/Quiz/useQuizStore/index.mjs +203 -85
- package/dist/Quiz/useQuizStore/index.mjs.map +1 -1
- package/dist/Radio/index.js +36 -6
- package/dist/Radio/index.js.map +1 -1
- package/dist/Radio/index.mjs +36 -6
- package/dist/Radio/index.mjs.map +1 -1
- package/dist/Select/index.js +20 -4
- package/dist/Select/index.js.map +1 -1
- package/dist/Select/index.mjs +20 -4
- package/dist/Select/index.mjs.map +1 -1
- package/dist/SelectionButton/index.js +10 -1
- package/dist/SelectionButton/index.js.map +1 -1
- package/dist/SelectionButton/index.mjs +10 -1
- package/dist/SelectionButton/index.mjs.map +1 -1
- package/dist/Skeleton/index.js +18 -6
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Skeleton/index.mjs +18 -6
- package/dist/Skeleton/index.mjs.map +1 -1
- package/dist/Stepper/index.js +27 -18
- package/dist/Stepper/index.js.map +1 -1
- package/dist/Stepper/index.mjs +27 -18
- package/dist/Stepper/index.mjs.map +1 -1
- package/dist/Table/index.js +37 -13
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/index.mjs +37 -13
- package/dist/Table/index.mjs.map +1 -1
- package/dist/Text/index.js +10 -1
- package/dist/Text/index.js.map +1 -1
- package/dist/Text/index.mjs +8 -1
- package/dist/Text/index.mjs.map +1 -1
- package/dist/TextArea/index.js +17 -3
- package/dist/TextArea/index.js.map +1 -1
- package/dist/TextArea/index.mjs +17 -3
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Toast/Toaster/index.js +15 -1
- package/dist/Toast/Toaster/index.js.map +1 -1
- package/dist/Toast/Toaster/index.mjs +15 -1
- package/dist/Toast/Toaster/index.mjs.map +1 -1
- package/dist/Toast/index.js +15 -1
- package/dist/Toast/index.js.map +1 -1
- package/dist/Toast/index.mjs +15 -1
- package/dist/Toast/index.mjs.map +1 -1
- package/dist/index.css +8 -9
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +903 -325
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +901 -326
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +8 -9
- package/dist/styles.css.map +1 -1
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, CSSProperties } from 'react';\n\ninterface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n variant?: 'text' | 'circular' | 'rectangular' | 'rounded';\n width?: string | number;\n height?: string | number;\n animation?: 'pulse' | 'none';\n lines?: number;\n spacing?: 'none' | 'small' | 'medium' | 'large';\n}\n\nconst SKELETON_ANIMATION_CLASSES = {\n pulse: 'animate-pulse',\n none: '',\n};\n\nconst SKELETON_VARIANT_CLASSES = {\n text: 'h-4 bg-background-200 rounded',\n circular: 'bg-background-200 rounded-full',\n rectangular: 'bg-background-200',\n rounded: 'bg-background-200 rounded-lg',\n};\n\nconst SPACING_CLASSES = {\n none: '',\n small: 'space-y-1',\n medium: 'space-y-2',\n large: 'space-y-3',\n};\n\nconst Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n (\n {\n variant = 'text',\n width,\n height,\n animation = 'pulse',\n lines = 1,\n spacing = 'none',\n className = '',\n children,\n ...props\n },\n ref\n ) => {\n const animationClass = SKELETON_ANIMATION_CLASSES[animation];\n const variantClass = SKELETON_VARIANT_CLASSES[variant];\n const spacingClass = SPACING_CLASSES[spacing];\n\n const style: CSSProperties = {\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n };\n\n // Se for múltiplas linhas de texto\n if (variant === 'text' && lines > 1) {\n return (\n <div\n ref={ref}\n className={`flex flex-col ${spacingClass} ${className}`}\n {...props}\n >\n {Array.from({ length: lines }, (_, index) => (\n <div\n key={index}\n className={`${variantClass} ${animationClass}`}\n style={index === lines - 1 ? { width: '60%' } : undefined}\n />\n ))}\n </div>\n );\n }\n\n // Se for um único elemento\n return (\n <div\n ref={ref}\n className={`${variantClass} ${animationClass} ${className}`}\n style={style}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\n// Componentes específicos para casos comuns\nconst SkeletonText = forwardRef<HTMLDivElement, Omit<SkeletonProps, 'variant'>>(\n (props, ref) => <Skeleton ref={ref} variant=\"text\" {...props} />\n);\n\nconst SkeletonCircle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"circular\" {...props} />);\n\nconst SkeletonRectangle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rectangular\" {...props} />);\n\nconst SkeletonRounded = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rounded\" {...props} />);\n\n// Componente para card skeleton\ninterface SkeletonCardProps extends HTMLAttributes<HTMLDivElement> {\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n showActions?: boolean;\n lines?: number;\n}\n\nconst SkeletonCard = forwardRef<HTMLDivElement, SkeletonCardProps>(\n (\n {\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n showActions = true,\n lines = 2,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={`w-full p-4 bg-background border border-border-200 rounded-lg ${className}`}\n {...props}\n >\n <div className=\"flex items-start space-x-3\">\n {showAvatar && <SkeletonCircle width={40} height={40} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"60%\" height={20} />}\n\n {showDescription && <SkeletonText lines={lines} spacing=\"small\" />}\n </div>\n </div>\n\n {showActions && (\n <div className=\"flex justify-end space-x-2 mt-4\">\n <SkeletonRectangle width={80} height={32} />\n <SkeletonRectangle width={80} height={32} />\n </div>\n )}\n </div>\n );\n }\n);\n\n// Componente para lista skeleton\ninterface SkeletonListProps extends HTMLAttributes<HTMLDivElement> {\n items?: number;\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n lines?: number;\n}\n\nconst SkeletonList = forwardRef<HTMLDivElement, SkeletonListProps>(\n (\n {\n items = 3,\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n lines = 1,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div ref={ref} className={`space-y-3 ${className}`} {...props}>\n {Array.from({ length: items }, (_, index) => (\n <div key={index} className=\"flex items-start space-x-3 p-3\">\n {showAvatar && <SkeletonCircle width={32} height={32} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"40%\" height={16} />}\n\n {showDescription && (\n <SkeletonText lines={lines} spacing=\"small\" />\n )}\n </div>\n </div>\n ))}\n </div>\n );\n }\n);\n\n// Componente para tabela skeleton\ninterface SkeletonTableProps extends HTMLAttributes<HTMLDivElement> {\n rows?: number;\n columns?: number;\n showHeader?: boolean;\n}\n\nconst SkeletonTable = forwardRef<HTMLDivElement, SkeletonTableProps>(\n (\n { rows = 5, columns = 4, showHeader = true, className = '', ...props },\n ref\n ) => {\n return (\n <div ref={ref} className={`w-full ${className}`} {...props}>\n {showHeader && (\n <div className=\"flex space-x-2 mb-3\">\n {Array.from({ length: columns }, (_, index) => (\n <SkeletonText\n key={index}\n width={`${100 / columns}%`}\n height={20}\n />\n ))}\n </div>\n )}\n\n <div className=\"space-y-2\">\n {Array.from({ length: rows }, (_, rowIndex) => (\n <div key={rowIndex} className=\"flex space-x-2\">\n {Array.from({ length: columns }, (_, colIndex) => (\n <SkeletonText\n key={colIndex}\n width={`${100 / columns}%`}\n height={16}\n />\n ))}\n </div>\n ))}\n </div>\n </div>\n );\n }\n);\n\nexport {\n Skeleton,\n SkeletonText,\n SkeletonCircle,\n SkeletonRectangle,\n SkeletonRounded,\n SkeletonCard,\n SkeletonList,\n SkeletonTable,\n};\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AGP,CACD,KAPO,QAQV,CACD,GACH;AAAA,OACF;AAAA,EAEJ;AACF;","names":["_"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/Skeleton/Skeleton.tsx","../../src/utils/utils.ts"],"sourcesContent":["import { forwardRef, HTMLAttributes, CSSProperties } from 'react';\nimport { cn } from '../../utils/utils';\n\ninterface SkeletonProps extends HTMLAttributes<HTMLDivElement> {\n variant?: 'text' | 'circular' | 'rectangular' | 'rounded';\n width?: string | number;\n height?: string | number;\n animation?: 'pulse' | 'none';\n lines?: number;\n spacing?: 'none' | 'small' | 'medium' | 'large';\n}\n\nconst SKELETON_ANIMATION_CLASSES = {\n pulse: 'animate-pulse',\n none: '',\n};\n\nconst SKELETON_VARIANT_CLASSES = {\n text: 'h-4 bg-background-200 rounded',\n circular: 'bg-background-200 rounded-full',\n rectangular: 'bg-background-200',\n rounded: 'bg-background-200 rounded-lg',\n};\n\nconst SPACING_CLASSES = {\n none: '',\n small: 'space-y-1',\n medium: 'space-y-2',\n large: 'space-y-3',\n};\n\nconst Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(\n (\n {\n variant = 'text',\n width,\n height,\n animation = 'pulse',\n lines = 1,\n spacing = 'none',\n className = '',\n children,\n ...props\n },\n ref\n ) => {\n const animationClass = SKELETON_ANIMATION_CLASSES[animation];\n const variantClass = SKELETON_VARIANT_CLASSES[variant];\n const spacingClass = SPACING_CLASSES[spacing];\n\n const style: CSSProperties = {\n width: typeof width === 'number' ? `${width}px` : width,\n height: typeof height === 'number' ? `${height}px` : height,\n };\n\n // Se for múltiplas linhas de texto\n if (variant === 'text' && lines > 1) {\n return (\n <div\n ref={ref}\n className={cn('flex flex-col', spacingClass, className)}\n {...props}\n >\n {Array.from({ length: lines }, (_, index) => (\n <div\n key={index}\n className={cn(variantClass, animationClass)}\n style={index === lines - 1 ? { width: '60%' } : undefined}\n />\n ))}\n </div>\n );\n }\n\n // Se for um único elemento\n return (\n <div\n ref={ref}\n className={cn(variantClass, animationClass, className)}\n style={style}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\n// Componentes específicos para casos comuns\nconst SkeletonText = forwardRef<HTMLDivElement, Omit<SkeletonProps, 'variant'>>(\n (props, ref) => <Skeleton ref={ref} variant=\"text\" {...props} />\n);\n\nconst SkeletonCircle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"circular\" {...props} />);\n\nconst SkeletonRectangle = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rectangular\" {...props} />);\n\nconst SkeletonRounded = forwardRef<\n HTMLDivElement,\n Omit<SkeletonProps, 'variant'>\n>((props, ref) => <Skeleton ref={ref} variant=\"rounded\" {...props} />);\n\n// Componente para card skeleton\ninterface SkeletonCardProps extends HTMLAttributes<HTMLDivElement> {\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n showActions?: boolean;\n lines?: number;\n}\n\nconst SkeletonCard = forwardRef<HTMLDivElement, SkeletonCardProps>(\n (\n {\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n showActions = true,\n lines = 2,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'w-full p-4 bg-background border border-border-200 rounded-lg',\n className\n )}\n {...props}\n >\n <div className=\"flex items-start space-x-3\">\n {showAvatar && <SkeletonCircle width={40} height={40} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"60%\" height={20} />}\n\n {showDescription && <SkeletonText lines={lines} spacing=\"small\" />}\n </div>\n </div>\n\n {showActions && (\n <div className=\"flex justify-end space-x-2 mt-4\">\n <SkeletonRectangle width={80} height={32} />\n <SkeletonRectangle width={80} height={32} />\n </div>\n )}\n </div>\n );\n }\n);\n\n// Componente para lista skeleton\ninterface SkeletonListProps extends HTMLAttributes<HTMLDivElement> {\n items?: number;\n showAvatar?: boolean;\n showTitle?: boolean;\n showDescription?: boolean;\n lines?: number;\n}\n\nconst SkeletonList = forwardRef<HTMLDivElement, SkeletonListProps>(\n (\n {\n items = 3,\n showAvatar = true,\n showTitle = true,\n showDescription = true,\n lines = 1,\n className = '',\n ...props\n },\n ref\n ) => {\n return (\n <div ref={ref} className={cn('space-y-3', className)} {...props}>\n {Array.from({ length: items }, (_, index) => (\n <div key={index} className=\"flex items-start space-x-3 p-3\">\n {showAvatar && <SkeletonCircle width={32} height={32} />}\n\n <div className=\"flex-1 space-y-2\">\n {showTitle && <SkeletonText width=\"40%\" height={16} />}\n\n {showDescription && (\n <SkeletonText lines={lines} spacing=\"small\" />\n )}\n </div>\n </div>\n ))}\n </div>\n );\n }\n);\n\n// Componente para tabela skeleton\ninterface SkeletonTableProps extends HTMLAttributes<HTMLDivElement> {\n rows?: number;\n columns?: number;\n showHeader?: boolean;\n}\n\nconst SkeletonTable = forwardRef<HTMLDivElement, SkeletonTableProps>(\n (\n { rows = 5, columns = 4, showHeader = true, className = '', ...props },\n ref\n ) => {\n return (\n <div ref={ref} className={cn('w-full', className)} {...props}>\n {showHeader && (\n <div className=\"flex space-x-2 mb-3\">\n {Array.from({ length: columns }, (_, index) => (\n <SkeletonText\n key={index}\n width={`${100 / columns}%`}\n height={20}\n />\n ))}\n </div>\n )}\n\n <div className=\"space-y-2\">\n {Array.from({ length: rows }, (_, rowIndex) => (\n <div key={rowIndex} className=\"flex space-x-2\">\n {Array.from({ length: columns }, (_, colIndex) => (\n <SkeletonText\n key={colIndex}\n width={`${100 / columns}%`}\n height={16}\n />\n ))}\n </div>\n ))}\n </div>\n </div>\n );\n }\n);\n\nexport {\n Skeleton,\n SkeletonText,\n SkeletonCircle,\n SkeletonRectangle,\n SkeletonRounded,\n SkeletonCard,\n SkeletonList,\n SkeletonTable,\n};\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";A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AACA,IAAG,aACnC;AAAA,QAAC;AAAA;AAAA,UAEC,OAAO,GAAG,MAAM,OAAO;AAAA,UACvB,QAAQ;AAAA;AAAA,QAFH;AAAA,MAGP,CACD,KAPO,QAQV,CACD,GACH;AAAA,OACF;AAAA,EAEJ;AACF;","names":["_"]}
|
package/dist/Stepper/index.js
CHANGED
|
@@ -25,6 +25,13 @@ __export(Stepper_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(Stepper_exports);
|
|
27
27
|
|
|
28
|
+
// src/utils/utils.ts
|
|
29
|
+
var import_clsx = require("clsx");
|
|
30
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
31
|
+
function cn(...inputs) {
|
|
32
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
// src/components/Text/Text.tsx
|
|
29
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
37
|
var Text = ({
|
|
@@ -68,7 +75,7 @@ var Text = ({
|
|
|
68
75
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
76
|
Component,
|
|
70
77
|
{
|
|
71
|
-
className:
|
|
78
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
72
79
|
...props,
|
|
73
80
|
children
|
|
74
81
|
}
|
|
@@ -262,7 +269,10 @@ var Step = ({
|
|
|
262
269
|
size: sizeClasses.indicatorTextSize,
|
|
263
270
|
weight: "medium",
|
|
264
271
|
color: "",
|
|
265
|
-
className:
|
|
272
|
+
className: cn(
|
|
273
|
+
stateClasses.indicatorText,
|
|
274
|
+
"leading-none text-2xs sm:text-xs"
|
|
275
|
+
),
|
|
266
276
|
children: stepNumber
|
|
267
277
|
}
|
|
268
278
|
)
|
|
@@ -274,13 +284,10 @@ var Step = ({
|
|
|
274
284
|
size: sizeClasses.labelTextSize,
|
|
275
285
|
weight: "medium",
|
|
276
286
|
color: "",
|
|
277
|
-
className:
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
text-2xs sm:text-xs md:text-xs lg:text-sm
|
|
282
|
-
whitespace-normal
|
|
283
|
-
`,
|
|
287
|
+
className: cn(
|
|
288
|
+
stateClasses.label,
|
|
289
|
+
"leading-tight flex-none text-center sm:text-left break-words px-1 sm:px-0 max-w-full text-2xs sm:text-xs md:text-xs lg:text-sm whitespace-normal"
|
|
290
|
+
),
|
|
284
291
|
children: step.label
|
|
285
292
|
}
|
|
286
293
|
)
|
|
@@ -326,7 +333,11 @@ var Stepper = ({
|
|
|
326
333
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
327
334
|
"fieldset",
|
|
328
335
|
{
|
|
329
|
-
className:
|
|
336
|
+
className: cn(
|
|
337
|
+
"flex flex-col gap-4 sm:gap-5 md:gap-6",
|
|
338
|
+
className,
|
|
339
|
+
"border-0 p-0 m-0"
|
|
340
|
+
),
|
|
330
341
|
children: [
|
|
331
342
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("legend", { className: "absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", children: "Stepper de formul\xE1rio" }),
|
|
332
343
|
showProgress && currentStep !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -341,14 +352,12 @@ var Stepper = ({
|
|
|
341
352
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
342
353
|
"div",
|
|
343
354
|
{
|
|
344
|
-
className:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
gap-2 sm:gap-3 md:gap-4 lg:gap-4
|
|
351
|
-
`,
|
|
355
|
+
className: cn(
|
|
356
|
+
"flex items-center",
|
|
357
|
+
sizeClasses.container,
|
|
358
|
+
responsive ? "flex-row overflow-x-auto overflow-y-hidden scrollbar-hide justify-start sm:justify-center md:justify-center lg:justify-center" : "flex-row justify-center",
|
|
359
|
+
"px-2 sm:px-4 md:px-6 lg:px-0 max-w-full min-w-0 gap-2 sm:gap-3 md:gap-4 lg:gap-4"
|
|
360
|
+
),
|
|
352
361
|
role: "tablist",
|
|
353
362
|
"aria-label": "Progress steps",
|
|
354
363
|
children: steps.map((step, index) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Stepper/Stepper.tsx","../../src/components/Text/Text.tsx"],"sourcesContent":["// ReactNode removed as it's not used in this component\nimport Text from '../Text/Text';\nimport { Check } from 'phosphor-react';\n\n/**\n * Stepper size variants\n */\ntype StepperSize = 'small' | 'medium' | 'large' | 'extraLarge';\n\n/**\n * Step state variants\n */\ntype StepState = 'pending' | 'current' | 'completed';\n\n/**\n * Individual step data interface\n */\nexport interface StepData {\n /** Unique identifier for the step */\n id: string;\n /** Label text for the step */\n label: string;\n /** Current state of the step */\n state: StepState;\n}\n\n/**\n * Size configurations - Following design system pattern from CSS specifications\n * Small size based on exact CSS: width 58px, height 38px, gap 8px\n */\nconst SIZE_CLASSES = {\n small: {\n container: 'gap-2', // 8px gap as specified in CSS\n stepWidth: 'w-[58px]', // exact 58px from CSS\n stepHeight: 'h-[38px]', // exact 38px from CSS\n indicator: 'w-5 h-5', // 20px as specified\n progressBar: 'h-0.5', // 2px as specified\n indicatorTextSize: '2xs', // 10px as specified\n labelTextSize: 'xs', // 12px as specified\n iconSize: 'w-3 h-3', // 12px\n },\n medium: {\n container: 'gap-3', // 12px (8px + 4px progression)\n stepWidth: 'w-[110px]', // 110px (increased from 90px to fit \"Endereço Residencial\")\n stepHeight: 'h-[48px]', // 48px (increased from 46px for better proportion)\n indicator: 'w-6 h-6', // 24px (20px + 4px progression)\n progressBar: 'h-0.5', // 2px maintained for consistency\n indicatorTextSize: '2xs', // 10px maintained for readability\n labelTextSize: 'xs', // 12px maintained\n iconSize: 'w-3.5 h-3.5', // 14px\n },\n large: {\n container: 'gap-4', // 16px (12px + 4px progression)\n stepWidth: 'w-[160px]', // 160px (increased from 140px to fit \"Endereço Residencial\")\n stepHeight: 'h-[58px]', // 58px (increased from 54px for better proportion)\n indicator: 'w-7 h-7', // 28px (24px + 4px progression)\n progressBar: 'h-1', // 4px (increased for better visibility)\n indicatorTextSize: 'xs', // 12px (increased for larger size)\n labelTextSize: 'sm', // 14px (increased for larger size)\n iconSize: 'w-4 h-4', // 16px\n },\n extraLarge: {\n container: 'gap-5', // 20px (16px + 4px progression)\n stepWidth: 'w-[200px]', // 200px (increased from 180px to ensure \"Endereço Residencial\" fits)\n stepHeight: 'h-[68px]', // 68px (increased from 62px for better proportion)\n indicator: 'w-8 h-8', // 32px (28px + 4px progression)\n progressBar: 'h-1', // 4px maintained\n indicatorTextSize: 'xs', // 12px maintained for readability\n labelTextSize: 'sm', // 14px maintained\n iconSize: 'w-[18px] h-[18px]', // 18px\n },\n} as const;\n\n/**\n * State configurations using exact colors from CSS specs\n * pending: #A3A3A3 = text-400 (etapa ainda não iniciada)\n * current: #1C61B2 = primary-800 (etapa atual sendo preenchida) - baseado no CSS fornecido\n * completed: #1C61B2 = primary-800 (etapa concluída)\n * text color: #FEFEFF = text\n */\nconst STATE_CLASSES = {\n pending: {\n progressBar: 'bg-text-400', // #A3A3A3\n indicator: 'bg-text-400', // #A3A3A3\n indicatorText: 'text-white', // Branco para contraste com background cinza\n label: 'text-text-400', // #A3A3A3\n },\n current: {\n progressBar: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicator: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-800', // #1C61B2 usando classe Tailwind padrão\n },\n completed: {\n progressBar: 'bg-primary-400', // #48A0E8 para barra quando checked (completed)\n indicator: 'bg-primary-400', // #48A0E8 para corresponder à barra de progresso\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-400', // #48A0E8 para corresponder à barra de progresso\n },\n} as const;\n\n/**\n * Type for size classes\n */\ntype SizeClassType = (typeof SIZE_CLASSES)[keyof typeof SIZE_CLASSES];\n\n/**\n * Type for state classes\n */\ntype StateClassType = (typeof STATE_CLASSES)[keyof typeof STATE_CLASSES];\n\n/**\n * Props for individual step component\n */\ninterface StepProps {\n step: StepData;\n index: number;\n size: StepperSize;\n sizeClasses: SizeClassType;\n stateClasses: StateClassType;\n isLast: boolean;\n className?: string;\n}\n\n/**\n * Individual Step component - Based on exact design specifications\n * Layout: flex-column with progress bar at top, then icon+label row\n * Fully responsive for mobile, tablets, and laptops\n */\nexport const Step = ({\n step,\n index,\n size: _size,\n sizeClasses,\n stateClasses,\n isLast: _isLast,\n className = '',\n}: StepProps) => {\n const stepNumber = index + 1;\n const isCompleted = step.state === 'completed';\n\n // Generate accessible aria-label based on step state\n const getAriaLabel = () => {\n let suffix = '';\n if (step.state === 'completed') {\n suffix = ' (concluído)';\n } else if (step.state === 'current') {\n suffix = ' (atual)';\n }\n return `${step.label}${suffix}`;\n };\n\n return (\n <div\n className={`\n flex flex-col justify-center items-center pb-2 gap-2\n ${sizeClasses.stepWidth} ${sizeClasses.stepHeight}\n flex-none flex-grow\n ${className}\n sm:max-w-[100px] md:max-w-[120px] lg:max-w-none xl:max-w-none\n sm:min-h-[40px] md:min-h-[45px] lg:min-h-none\n overflow-visible\n `}\n >\n {/* Progress Bar - Full width at top with responsive scaling */}\n <div\n className={`\n w-full ${sizeClasses.progressBar} ${stateClasses.progressBar}\n rounded-sm flex-none\n `}\n />\n\n {/* Step Content Container - Responsive layout for all devices, no vertical scroll */}\n <div\n className={`\n flex flex-col sm:flex-row items-center\n gap-1 sm:gap-2 w-full sm:w-auto\n h-auto sm:h-5 flex-none\n overflow-visible\n `}\n >\n {/* Step Indicator Circle with responsive sizing */}\n <div\n className={`\n ${sizeClasses.indicator} ${stateClasses.indicator}\n rounded-full flex items-center justify-center relative\n flex-none transition-all duration-300 ease-out\n w-4 h-4 sm:w-5 sm:h-5 md:w-5 md:h-5 lg:w-6 lg:h-6\n `}\n aria-label={getAriaLabel()}\n >\n {isCompleted ? (\n <Check\n weight=\"bold\"\n className={`\n ${stateClasses.indicatorText}\n w-2.5 h-2.5 sm:w-3 sm:h-3 md:w-3 md:h-3 lg:w-3.5 lg:h-3.5\n `}\n />\n ) : (\n <Text\n size={sizeClasses.indicatorTextSize as '2xs' | 'xs' | 'sm'}\n weight=\"medium\"\n color=\"\"\n className={`${stateClasses.indicatorText} leading-none text-2xs sm:text-xs`}\n >\n {stepNumber}\n </Text>\n )}\n </div>\n\n {/* Step Label with full responsive text sizing, no vertical overflow */}\n <Text\n size={sizeClasses.labelTextSize as '2xs' | 'xs' | 'sm' | 'md'}\n weight=\"medium\"\n color=\"\"\n className={`\n ${stateClasses.label} leading-tight flex-none\n text-center sm:text-left break-words\n px-1 sm:px-0 max-w-full\n text-2xs sm:text-xs md:text-xs lg:text-sm\n whitespace-normal\n `}\n >\n {step.label}\n </Text>\n </div>\n </div>\n );\n};\n\n/**\n * Stepper component props interface\n */\nexport type StepperProps = {\n /** Array of step data */\n steps: StepData[];\n /** Size variant of the stepper */\n size?: StepperSize;\n /** Current active step index */\n currentStep?: number;\n /** Additional CSS classes */\n className?: string;\n /** Step container CSS classes */\n stepClassName?: string;\n /** Progress indicator (e.g., \"Etapa 2 de 4\") */\n showProgress?: boolean;\n /** Custom progress text */\n progressText?: string;\n /** Make stepper responsive (vertical on mobile) */\n responsive?: boolean;\n};\n\n/**\n * Helper function to calculate step states based on current step\n */\nconst calculateStepStates = (\n steps: StepData[],\n currentStep: number\n): StepData[] => {\n return steps.map((step, index) => {\n let stepState: StepState;\n\n if (index < currentStep) {\n stepState = 'completed';\n } else if (index === currentStep) {\n stepState = 'current';\n } else {\n stepState = 'pending';\n }\n\n return {\n ...step,\n state: stepState,\n };\n });\n};\n\n/**\n * Helper function to get progress text\n */\nconst getProgressText = (\n currentStep: number,\n totalSteps: number,\n customText?: string\n): string => {\n if (customText) return customText;\n return `Etapa ${currentStep + 1} de ${totalSteps}`;\n};\n\n/**\n * Stepper component for Analytica Ensino platforms\n *\n * A progress stepper component that displays a sequence of steps with different states.\n * Follows the exact design specifications with proper spacing, colors, and layout.\n * Fully responsive for mobile, tablets, and laptops.\n *\n * Design specifications:\n * - Based on exact CSS specifications from Figma design\n * - Fully responsive: mobile (320px+) -> tablets (640px+) -> laptops (1024px+)\n * - Progressive sizing with responsive breakpoints that adapt to device type\n * - Consistent gaps that scale with screen size and device capabilities\n * - Consistent color scheme: pending (gray), current (dark blue), completed (light blue)\n * - Responsive design with overflow scroll on smaller devices\n * - Optimized text sizing and layout for each device category\n *\n * @example\n * ```tsx\n * // Basic stepper - automatically responsive for all devices\n * <Stepper steps={steps} currentStep={1} />\n *\n * // Custom styling with full responsive behavior\n * <Stepper steps={steps} size=\"medium\" showProgress responsive />\n * ```\n */\nconst Stepper = ({\n steps: initialSteps,\n size = 'medium',\n currentStep,\n className = '',\n stepClassName = '',\n showProgress = false,\n progressText,\n responsive = true,\n}: StepperProps) => {\n const sizeClasses = SIZE_CLASSES[size];\n\n // Calculate steps with states if currentStep is provided\n const steps =\n currentStep !== undefined\n ? calculateStepStates(initialSteps, currentStep)\n : initialSteps;\n\n return (\n <fieldset\n className={`flex flex-col gap-4 sm:gap-5 md:gap-6 ${className} border-0 p-0 m-0`}\n >\n <legend className=\"absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0\">\n Stepper de formulário\n </legend>\n {/* Progress indicator with responsive text */}\n {showProgress && currentStep !== undefined && (\n <Text\n size=\"sm\"\n weight=\"medium\"\n className=\"text-text-600 text-center sm:text-left text-xs sm:text-sm\"\n >\n {getProgressText(currentStep, steps.length, progressText)}\n </Text>\n )}\n\n {/* Stepper container - Fully responsive for all devices with horizontal scroll only */}\n <div\n className={`\n flex items-center\n ${sizeClasses.container}\n ${\n responsive\n ? 'flex-row overflow-x-auto overflow-y-hidden scrollbar-hide justify-start sm:justify-center md:justify-center lg:justify-center'\n : 'flex-row justify-center'\n }\n px-2 sm:px-4 md:px-6 lg:px-0\n max-w-full min-w-0\n gap-2 sm:gap-3 md:gap-4 lg:gap-4\n `}\n role=\"tablist\"\n aria-label=\"Progress steps\"\n >\n {steps.map((step, index) => {\n const stateClasses = STATE_CLASSES[step.state];\n\n return (\n <Step\n key={step.id}\n step={step}\n index={index}\n size={size}\n sizeClasses={sizeClasses}\n stateClasses={stateClasses}\n isLast={index === steps.length - 1}\n className={stepClassName}\n />\n );\n })}\n </div>\n </fieldset>\n );\n};\n\nexport default Stepper;\n","import { ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';\n\n/**\n * Base text component props\n */\ntype BaseTextProps = {\n /** Content to be displayed */\n children?: ReactNode;\n /** Text size variant */\n size?:\n | '2xs'\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | '4xl'\n | '5xl'\n | '6xl';\n /** Font weight variant */\n weight?:\n | 'hairline'\n | 'light'\n | 'normal'\n | 'medium'\n | 'semibold'\n | 'bold'\n | 'extrabold'\n | 'black';\n /** Color variant - white for light backgrounds, black for dark backgrounds */\n color?: string;\n /** Additional CSS classes to apply */\n className?: string;\n};\n\n/**\n * Polymorphic text component props that ensures type safety based on the 'as' prop\n */\ntype TextProps<T extends ElementType = 'p'> = BaseTextProps & {\n /** HTML tag to render */\n as?: T;\n} & Omit<ComponentPropsWithoutRef<T>, keyof BaseTextProps>;\n\n/**\n * Text component for Analytica Ensino platforms\n *\n * A flexible polymorphic text component with multiple sizes, weights, and colors.\n * Automatically adapts to dark and light themes with full type safety.\n *\n * @param children - The content to display\n * @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)\n * @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)\n * @param color - The color variant - adapts to theme\n * @param as - The HTML tag to render - determines allowed attributes via TypeScript\n * @param className - Additional CSS classes\n * @param props - HTML attributes valid for the chosen tag only\n * @returns A styled text element with type-safe attributes\n *\n * @example\n * ```tsx\n * <Text size=\"lg\" weight=\"bold\" color=\"text-info-800\">\n * This is a large, bold text\n * </Text>\n *\n * <Text as=\"a\" href=\"/link\" target=\"_blank\">\n * Link with type-safe anchor attributes\n * </Text>\n *\n * <Text as=\"button\" onClick={handleClick} disabled>\n * Button with type-safe button attributes\n * </Text>\n * ```\n */\nconst Text = <T extends ElementType = 'p'>({\n children,\n size = 'md',\n weight = 'normal',\n color = 'text-text-950',\n as,\n className = '',\n ...props\n}: TextProps<T>) => {\n let sizeClasses = '';\n let weightClasses = '';\n\n // Text size classes mapping\n const sizeClassMap = {\n '2xs': 'text-2xs',\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-md',\n lg: 'text-lg',\n xl: 'text-xl',\n '2xl': 'text-2xl',\n '3xl': 'text-3xl',\n '4xl': 'text-4xl',\n '5xl': 'text-5xl',\n '6xl': 'text-6xl',\n } as const;\n\n sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;\n\n // Font weight classes mapping\n const weightClassMap = {\n hairline: 'font-hairline',\n light: 'font-light',\n normal: 'font-normal',\n medium: 'font-medium',\n semibold: 'font-semibold',\n bold: 'font-bold',\n extrabold: 'font-extrabold',\n black: 'font-black',\n } as const;\n\n weightClasses = weightClassMap[weight] ?? weightClassMap.normal;\n\n const baseClasses = 'font-primary';\n const Component = as ?? ('p' as ElementType);\n\n return (\n <Component\n className={`${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`}\n {...props}\n >\n {children}\n </Component>\n );\n};\n\nexport default Text;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC0HI;AA/CJ,IAAM,OAAO,CAA8B;AAAA,EACzC;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,MAAoB;AAClB,MAAI,cAAc;AAClB,MAAI,gBAAgB;AAGpB,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,IACP,IA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per.tsx","../../src/utils/utils.ts","../../src/components/Text/Text.tsx"],"sourcesContent":["import Text from '../Text/Text';\nimport { Check } from 'phosphor-react';\nimport { cn } from '../../utils/utils';\n\n/**\n * Stepper size variants\n */\ntype StepperSize = 'small' | 'medium' | 'large' | 'extraLarge';\n\n/**\n * Step state variants\n */\ntype StepState = 'pending' | 'current' | 'completed';\n\n/**\n * Individual step data interface\n */\nexport interface StepData {\n /** Unique identifier for the step */\n id: string;\n /** Label text for the step */\n label: string;\n /** Current state of the step */\n state: StepState;\n}\n\n/**\n * Size configurations - Following design system pattern from CSS specifications\n * Small size based on exact CSS: width 58px, height 38px, gap 8px\n */\nconst SIZE_CLASSES = {\n small: {\n container: 'gap-2', // 8px gap as specified in CSS\n stepWidth: 'w-[58px]', // exact 58px from CSS\n stepHeight: 'h-[38px]', // exact 38px from CSS\n indicator: 'w-5 h-5', // 20px as specified\n progressBar: 'h-0.5', // 2px as specified\n indicatorTextSize: '2xs', // 10px as specified\n labelTextSize: 'xs', // 12px as specified\n iconSize: 'w-3 h-3', // 12px\n },\n medium: {\n container: 'gap-3', // 12px (8px + 4px progression)\n stepWidth: 'w-[110px]', // 110px (increased from 90px to fit \"Endereço Residencial\")\n stepHeight: 'h-[48px]', // 48px (increased from 46px for better proportion)\n indicator: 'w-6 h-6', // 24px (20px + 4px progression)\n progressBar: 'h-0.5', // 2px maintained for consistency\n indicatorTextSize: '2xs', // 10px maintained for readability\n labelTextSize: 'xs', // 12px maintained\n iconSize: 'w-3.5 h-3.5', // 14px\n },\n large: {\n container: 'gap-4', // 16px (12px + 4px progression)\n stepWidth: 'w-[160px]', // 160px (increased from 140px to fit \"Endereço Residencial\")\n stepHeight: 'h-[58px]', // 58px (increased from 54px for better proportion)\n indicator: 'w-7 h-7', // 28px (24px + 4px progression)\n progressBar: 'h-1', // 4px (increased for better visibility)\n indicatorTextSize: 'xs', // 12px (increased for larger size)\n labelTextSize: 'sm', // 14px (increased for larger size)\n iconSize: 'w-4 h-4', // 16px\n },\n extraLarge: {\n container: 'gap-5', // 20px (16px + 4px progression)\n stepWidth: 'w-[200px]', // 200px (increased from 180px to ensure \"Endereço Residencial\" fits)\n stepHeight: 'h-[68px]', // 68px (increased from 62px for better proportion)\n indicator: 'w-8 h-8', // 32px (28px + 4px progression)\n progressBar: 'h-1', // 4px maintained\n indicatorTextSize: 'xs', // 12px maintained for readability\n labelTextSize: 'sm', // 14px maintained\n iconSize: 'w-[18px] h-[18px]', // 18px\n },\n} as const;\n\n/**\n * State configurations using exact colors from CSS specs\n * pending: #A3A3A3 = text-400 (etapa ainda não iniciada)\n * current: #1C61B2 = primary-800 (etapa atual sendo preenchida) - baseado no CSS fornecido\n * completed: #1C61B2 = primary-800 (etapa concluída)\n * text color: #FEFEFF = text\n */\nconst STATE_CLASSES = {\n pending: {\n progressBar: 'bg-text-400', // #A3A3A3\n indicator: 'bg-text-400', // #A3A3A3\n indicatorText: 'text-white', // Branco para contraste com background cinza\n label: 'text-text-400', // #A3A3A3\n },\n current: {\n progressBar: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicator: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-800', // #1C61B2 usando classe Tailwind padrão\n },\n completed: {\n progressBar: 'bg-primary-400', // #48A0E8 para barra quando checked (completed)\n indicator: 'bg-primary-400', // #48A0E8 para corresponder à barra de progresso\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-400', // #48A0E8 para corresponder à barra de progresso\n },\n} as const;\n\n/**\n * Type for size classes\n */\ntype SizeClassType = (typeof SIZE_CLASSES)[keyof typeof SIZE_CLASSES];\n\n/**\n * Type for state classes\n */\ntype StateClassType = (typeof STATE_CLASSES)[keyof typeof STATE_CLASSES];\n\n/**\n * Props for individual step component\n */\ninterface StepProps {\n step: StepData;\n index: number;\n size: StepperSize;\n sizeClasses: SizeClassType;\n stateClasses: StateClassType;\n isLast: boolean;\n className?: string;\n}\n\n/**\n * Individual Step component - Based on exact design specifications\n * Layout: flex-column with progress bar at top, then icon+label row\n * Fully responsive for mobile, tablets, and laptops\n */\nexport const Step = ({\n step,\n index,\n size: _size,\n sizeClasses,\n stateClasses,\n isLast: _isLast,\n className = '',\n}: StepProps) => {\n const stepNumber = index + 1;\n const isCompleted = step.state === 'completed';\n\n // Generate accessible aria-label based on step state\n const getAriaLabel = () => {\n let suffix = '';\n if (step.state === 'completed') {\n suffix = ' (concluído)';\n } else if (step.state === 'current') {\n suffix = ' (atual)';\n }\n return `${step.label}${suffix}`;\n };\n\n return (\n <div\n className={`\n flex flex-col justify-center items-center pb-2 gap-2\n ${sizeClasses.stepWidth} ${sizeClasses.stepHeight}\n flex-none flex-grow\n ${className}\n sm:max-w-[100px] md:max-w-[120px] lg:max-w-none xl:max-w-none\n sm:min-h-[40px] md:min-h-[45px] lg:min-h-none\n overflow-visible\n `}\n >\n {/* Progress Bar - Full width at top with responsive scaling */}\n <div\n className={`\n w-full ${sizeClasses.progressBar} ${stateClasses.progressBar}\n rounded-sm flex-none\n `}\n />\n\n {/* Step Content Container - Responsive layout for all devices, no vertical scroll */}\n <div\n className={`\n flex flex-col sm:flex-row items-center\n gap-1 sm:gap-2 w-full sm:w-auto\n h-auto sm:h-5 flex-none\n overflow-visible\n `}\n >\n {/* Step Indicator Circle with responsive sizing */}\n <div\n className={`\n ${sizeClasses.indicator} ${stateClasses.indicator}\n rounded-full flex items-center justify-center relative\n flex-none transition-all duration-300 ease-out\n w-4 h-4 sm:w-5 sm:h-5 md:w-5 md:h-5 lg:w-6 lg:h-6\n `}\n aria-label={getAriaLabel()}\n >\n {isCompleted ? (\n <Check\n weight=\"bold\"\n className={`\n ${stateClasses.indicatorText}\n w-2.5 h-2.5 sm:w-3 sm:h-3 md:w-3 md:h-3 lg:w-3.5 lg:h-3.5\n `}\n />\n ) : (\n <Text\n size={sizeClasses.indicatorTextSize as '2xs' | 'xs' | 'sm'}\n weight=\"medium\"\n color=\"\"\n className={cn(\n stateClasses.indicatorText,\n 'leading-none text-2xs sm:text-xs'\n )}\n >\n {stepNumber}\n </Text>\n )}\n </div>\n\n {/* Step Label with full responsive text sizing, no vertical overflow */}\n <Text\n size={sizeClasses.labelTextSize as '2xs' | 'xs' | 'sm' | 'md'}\n weight=\"medium\"\n color=\"\"\n className={cn(\n stateClasses.label,\n 'leading-tight flex-none text-center sm:text-left break-words px-1 sm:px-0 max-w-full text-2xs sm:text-xs md:text-xs lg:text-sm whitespace-normal'\n )}\n >\n {step.label}\n </Text>\n </div>\n </div>\n );\n};\n\n/**\n * Stepper component props interface\n */\nexport type StepperProps = {\n /** Array of step data */\n steps: StepData[];\n /** Size variant of the stepper */\n size?: StepperSize;\n /** Current active step index */\n currentStep?: number;\n /** Additional CSS classes */\n className?: string;\n /** Step container CSS classes */\n stepClassName?: string;\n /** Progress indicator (e.g., \"Etapa 2 de 4\") */\n showProgress?: boolean;\n /** Custom progress text */\n progressText?: string;\n /** Make stepper responsive (vertical on mobile) */\n responsive?: boolean;\n};\n\n/**\n * Helper function to calculate step states based on current step\n */\nconst calculateStepStates = (\n steps: StepData[],\n currentStep: number\n): StepData[] => {\n return steps.map((step, index) => {\n let stepState: StepState;\n\n if (index < currentStep) {\n stepState = 'completed';\n } else if (index === currentStep) {\n stepState = 'current';\n } else {\n stepState = 'pending';\n }\n\n return {\n ...step,\n state: stepState,\n };\n });\n};\n\n/**\n * Helper function to get progress text\n */\nconst getProgressText = (\n currentStep: number,\n totalSteps: number,\n customText?: string\n): string => {\n if (customText) return customText;\n return `Etapa ${currentStep + 1} de ${totalSteps}`;\n};\n\n/**\n * Stepper component for Analytica Ensino platforms\n *\n * A progress stepper component that displays a sequence of steps with different states.\n * Follows the exact design specifications with proper spacing, colors, and layout.\n * Fully responsive for mobile, tablets, and laptops.\n *\n * Design specifications:\n * - Based on exact CSS specifications from Figma design\n * - Fully responsive: mobile (320px+) -> tablets (640px+) -> laptops (1024px+)\n * - Progressive sizing with responsive breakpoints that adapt to device type\n * - Consistent gaps that scale with screen size and device capabilities\n * - Consistent color scheme: pending (gray), current (dark blue), completed (light blue)\n * - Responsive design with overflow scroll on smaller devices\n * - Optimized text sizing and layout for each device category\n *\n * @example\n * ```tsx\n * // Basic stepper - automatically responsive for all devices\n * <Stepper steps={steps} currentStep={1} />\n *\n * // Custom styling with full responsive behavior\n * <Stepper steps={steps} size=\"medium\" showProgress responsive />\n * ```\n */\nconst Stepper = ({\n steps: initialSteps,\n size = 'medium',\n currentStep,\n className = '',\n stepClassName = '',\n showProgress = false,\n progressText,\n responsive = true,\n}: StepperProps) => {\n const sizeClasses = SIZE_CLASSES[size];\n\n // Calculate steps with states if currentStep is provided\n const steps =\n currentStep !== undefined\n ? calculateStepStates(initialSteps, currentStep)\n : initialSteps;\n\n return (\n <fieldset\n className={cn(\n 'flex flex-col gap-4 sm:gap-5 md:gap-6',\n className,\n 'border-0 p-0 m-0'\n )}\n >\n <legend className=\"absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0\">\n Stepper de formulário\n </legend>\n {/* Progress indicator with responsive text */}\n {showProgress && currentStep !== undefined && (\n <Text\n size=\"sm\"\n weight=\"medium\"\n className=\"text-text-600 text-center sm:text-left text-xs sm:text-sm\"\n >\n {getProgressText(currentStep, steps.length, progressText)}\n </Text>\n )}\n\n {/* Stepper container - Fully responsive for all devices with horizontal scroll only */}\n <div\n className={cn(\n 'flex items-center',\n sizeClasses.container,\n responsive\n ? 'flex-row overflow-x-auto overflow-y-hidden scrollbar-hide justify-start sm:justify-center md:justify-center lg:justify-center'\n : 'flex-row justify-center',\n 'px-2 sm:px-4 md:px-6 lg:px-0 max-w-full min-w-0 gap-2 sm:gap-3 md:gap-4 lg:gap-4'\n )}\n role=\"tablist\"\n aria-label=\"Progress steps\"\n >\n {steps.map((step, index) => {\n const stateClasses = STATE_CLASSES[step.state];\n\n return (\n <Step\n key={step.id}\n step={step}\n index={index}\n size={size}\n sizeClasses={sizeClasses}\n stateClasses={stateClasses}\n isLast={index === steps.length - 1}\n className={stepClassName}\n />\n );\n })}\n </div>\n </fieldset>\n );\n};\n\nexport default Stepper;\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';\nimport { cn } from '../../utils/utils';\n\n/**\n * Base text component props\n */\ntype BaseTextProps = {\n /** Content to be displayed */\n children?: ReactNode;\n /** Text size variant */\n size?:\n | '2xs'\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | '4xl'\n | '5xl'\n | '6xl';\n /** Font weight variant */\n weight?:\n | 'hairline'\n | 'light'\n | 'normal'\n | 'medium'\n | 'semibold'\n | 'bold'\n | 'extrabold'\n | 'black';\n /** Color variant - white for light backgrounds, black for dark backgrounds */\n color?: string;\n /** Additional CSS classes to apply */\n className?: string;\n};\n\n/**\n * Polymorphic text component props that ensures type safety based on the 'as' prop\n */\ntype TextProps<T extends ElementType = 'p'> = BaseTextProps & {\n /** HTML tag to render */\n as?: T;\n} & Omit<ComponentPropsWithoutRef<T>, keyof BaseTextProps>;\n\n/**\n * Text component for Analytica Ensino platforms\n *\n * A flexible polymorphic text component with multiple sizes, weights, and colors.\n * Automatically adapts to dark and light themes with full type safety.\n *\n * @param children - The content to display\n * @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)\n * @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)\n * @param color - The color variant - adapts to theme\n * @param as - The HTML tag to render - determines allowed attributes via TypeScript\n * @param className - Additional CSS classes\n * @param props - HTML attributes valid for the chosen tag only\n * @returns A styled text element with type-safe attributes\n *\n * @example\n * ```tsx\n * <Text size=\"lg\" weight=\"bold\" color=\"text-info-800\">\n * This is a large, bold text\n * </Text>\n *\n * <Text as=\"a\" href=\"/link\" target=\"_blank\">\n * Link with type-safe anchor attributes\n * </Text>\n *\n * <Text as=\"button\" onClick={handleClick} disabled>\n * Button with type-safe button attributes\n * </Text>\n * ```\n */\nconst Text = <T extends ElementType = 'p'>({\n children,\n size = 'md',\n weight = 'normal',\n color = 'text-text-950',\n as,\n className = '',\n ...props\n}: TextProps<T>) => {\n let sizeClasses = '';\n let weightClasses = '';\n\n // Text size classes mapping\n const sizeClassMap = {\n '2xs': 'text-2xs',\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-md',\n lg: 'text-lg',\n xl: 'text-xl',\n '2xl': 'text-2xl',\n '3xl': 'text-3xl',\n '4xl': 'text-4xl',\n '5xl': 'text-5xl',\n '6xl': 'text-6xl',\n } as const;\n\n sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;\n\n // Font weight classes mapping\n const weightClassMap = {\n hairline: 'font-hairline',\n light: 'font-light',\n normal: 'font-normal',\n medium: 'font-medium',\n semibold: 'font-semibold',\n bold: 'font-bold',\n extrabold: 'font-extrabold',\n black: 'font-black',\n } as const;\n\n weightClasses = weightClassMap[weight] ?? weightClassMap.normal;\n\n const baseClasses = 'font-primary';\n const Component = as ?? ('p' as ElementType);\n\n return (\n <Component\n className={cn(baseClasses, sizeClasses, weightClasses, color, className)}\n {...props}\n >\n {children}\n </Component>\n );\n};\n\nexport default Text;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ACsHI;AA/CJ,IAAM,OAAO,CAA8B;AAAA,EACzC;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,MAAoB;AAClB,MAAI,cAAc;AAClB,MAAI,gBAAgB;AAGpB,QAAM,eAAe;A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stepper/index.mjs
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
// src/utils/utils.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
function cn(...inputs) {
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
// src/components/Text/Text.tsx
|
|
2
9
|
import { jsx } from "react/jsx-runtime";
|
|
3
10
|
var Text = ({
|
|
@@ -41,7 +48,7 @@ var Text = ({
|
|
|
41
48
|
return /* @__PURE__ */ jsx(
|
|
42
49
|
Component,
|
|
43
50
|
{
|
|
44
|
-
className:
|
|
51
|
+
className: cn(baseClasses, sizeClasses, weightClasses, color, className),
|
|
45
52
|
...props,
|
|
46
53
|
children
|
|
47
54
|
}
|
|
@@ -235,7 +242,10 @@ var Step = ({
|
|
|
235
242
|
size: sizeClasses.indicatorTextSize,
|
|
236
243
|
weight: "medium",
|
|
237
244
|
color: "",
|
|
238
|
-
className:
|
|
245
|
+
className: cn(
|
|
246
|
+
stateClasses.indicatorText,
|
|
247
|
+
"leading-none text-2xs sm:text-xs"
|
|
248
|
+
),
|
|
239
249
|
children: stepNumber
|
|
240
250
|
}
|
|
241
251
|
)
|
|
@@ -247,13 +257,10 @@ var Step = ({
|
|
|
247
257
|
size: sizeClasses.labelTextSize,
|
|
248
258
|
weight: "medium",
|
|
249
259
|
color: "",
|
|
250
|
-
className:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
text-2xs sm:text-xs md:text-xs lg:text-sm
|
|
255
|
-
whitespace-normal
|
|
256
|
-
`,
|
|
260
|
+
className: cn(
|
|
261
|
+
stateClasses.label,
|
|
262
|
+
"leading-tight flex-none text-center sm:text-left break-words px-1 sm:px-0 max-w-full text-2xs sm:text-xs md:text-xs lg:text-sm whitespace-normal"
|
|
263
|
+
),
|
|
257
264
|
children: step.label
|
|
258
265
|
}
|
|
259
266
|
)
|
|
@@ -299,7 +306,11 @@ var Stepper = ({
|
|
|
299
306
|
return /* @__PURE__ */ jsxs(
|
|
300
307
|
"fieldset",
|
|
301
308
|
{
|
|
302
|
-
className:
|
|
309
|
+
className: cn(
|
|
310
|
+
"flex flex-col gap-4 sm:gap-5 md:gap-6",
|
|
311
|
+
className,
|
|
312
|
+
"border-0 p-0 m-0"
|
|
313
|
+
),
|
|
303
314
|
children: [
|
|
304
315
|
/* @__PURE__ */ jsx2("legend", { className: "absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0", children: "Stepper de formul\xE1rio" }),
|
|
305
316
|
showProgress && currentStep !== void 0 && /* @__PURE__ */ jsx2(
|
|
@@ -314,14 +325,12 @@ var Stepper = ({
|
|
|
314
325
|
/* @__PURE__ */ jsx2(
|
|
315
326
|
"div",
|
|
316
327
|
{
|
|
317
|
-
className:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
gap-2 sm:gap-3 md:gap-4 lg:gap-4
|
|
324
|
-
`,
|
|
328
|
+
className: cn(
|
|
329
|
+
"flex items-center",
|
|
330
|
+
sizeClasses.container,
|
|
331
|
+
responsive ? "flex-row overflow-x-auto overflow-y-hidden scrollbar-hide justify-start sm:justify-center md:justify-center lg:justify-center" : "flex-row justify-center",
|
|
332
|
+
"px-2 sm:px-4 md:px-6 lg:px-0 max-w-full min-w-0 gap-2 sm:gap-3 md:gap-4 lg:gap-4"
|
|
333
|
+
),
|
|
325
334
|
role: "tablist",
|
|
326
335
|
"aria-label": "Progress steps",
|
|
327
336
|
children: steps.map((step, index) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Text/Text.tsx","../../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';\n\n/**\n * Base text component props\n */\ntype BaseTextProps = {\n /** Content to be displayed */\n children?: ReactNode;\n /** Text size variant */\n size?:\n | '2xs'\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | '4xl'\n | '5xl'\n | '6xl';\n /** Font weight variant */\n weight?:\n | 'hairline'\n | 'light'\n | 'normal'\n | 'medium'\n | 'semibold'\n | 'bold'\n | 'extrabold'\n | 'black';\n /** Color variant - white for light backgrounds, black for dark backgrounds */\n color?: string;\n /** Additional CSS classes to apply */\n className?: string;\n};\n\n/**\n * Polymorphic text component props that ensures type safety based on the 'as' prop\n */\ntype TextProps<T extends ElementType = 'p'> = BaseTextProps & {\n /** HTML tag to render */\n as?: T;\n} & Omit<ComponentPropsWithoutRef<T>, keyof BaseTextProps>;\n\n/**\n * Text component for Analytica Ensino platforms\n *\n * A flexible polymorphic text component with multiple sizes, weights, and colors.\n * Automatically adapts to dark and light themes with full type safety.\n *\n * @param children - The content to display\n * @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)\n * @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)\n * @param color - The color variant - adapts to theme\n * @param as - The HTML tag to render - determines allowed attributes via TypeScript\n * @param className - Additional CSS classes\n * @param props - HTML attributes valid for the chosen tag only\n * @returns A styled text element with type-safe attributes\n *\n * @example\n * ```tsx\n * <Text size=\"lg\" weight=\"bold\" color=\"text-info-800\">\n * This is a large, bold text\n * </Text>\n *\n * <Text as=\"a\" href=\"/link\" target=\"_blank\">\n * Link with type-safe anchor attributes\n * </Text>\n *\n * <Text as=\"button\" onClick={handleClick} disabled>\n * Button with type-safe button attributes\n * </Text>\n * ```\n */\nconst Text = <T extends ElementType = 'p'>({\n children,\n size = 'md',\n weight = 'normal',\n color = 'text-text-950',\n as,\n className = '',\n ...props\n}: TextProps<T>) => {\n let sizeClasses = '';\n let weightClasses = '';\n\n // Text size classes mapping\n const sizeClassMap = {\n '2xs': 'text-2xs',\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-md',\n lg: 'text-lg',\n xl: 'text-xl',\n '2xl': 'text-2xl',\n '3xl': 'text-3xl',\n '4xl': 'text-4xl',\n '5xl': 'text-5xl',\n '6xl': 'text-6xl',\n } as const;\n\n sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;\n\n // Font weight classes mapping\n const weightClassMap = {\n hairline: 'font-hairline',\n light: 'font-light',\n normal: 'font-normal',\n medium: 'font-medium',\n semibold: 'font-semibold',\n bold: 'font-bold',\n extrabold: 'font-extrabold',\n black: 'font-black',\n } as const;\n\n weightClasses = weightClassMap[weight] ?? weightClassMap.normal;\n\n const baseClasses = 'font-primary';\n const Component = as ?? ('p' as ElementType);\n\n return (\n <Component\n className={`${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`}\n {...props}\n >\n {children}\n </Component>\n );\n};\n\nexport default Text;\n","// ReactNode removed as it's not used in this component\nimport Text from '../Text/Text';\nimport { Check } from 'phosphor-react';\n\n/**\n * Stepper size variants\n */\ntype StepperSize = 'small' | 'medium' | 'large' | 'extraLarge';\n\n/**\n * Step state variants\n */\ntype StepState = 'pending' | 'current' | 'completed';\n\n/**\n * Individual step data interface\n */\nexport interface StepData {\n /** Unique identifier for the step */\n id: string;\n /** Label text for the step */\n label: string;\n /** Current state of the step */\n state: StepState;\n}\n\n/**\n * Size configurations - Following design system pattern from CSS specifications\n * Small size based on exact CSS: width 58px, height 38px, gap 8px\n */\nconst SIZE_CLASSES = {\n small: {\n container: 'gap-2', // 8px gap as specified in CSS\n stepWidth: 'w-[58px]', // exact 58px from CSS\n stepHeight: 'h-[38px]', // exact 38px from CSS\n indicator: 'w-5 h-5', // 20px as specified\n progressBar: 'h-0.5', // 2px as specified\n indicatorTextSize: '2xs', // 10px as specified\n labelTextSize: 'xs', // 12px as specified\n iconSize: 'w-3 h-3', // 12px\n },\n medium: {\n container: 'gap-3', // 12px (8px + 4px progression)\n stepWidth: 'w-[110px]', // 110px (increased from 90px to fit \"Endereço Residencial\")\n stepHeight: 'h-[48px]', // 48px (increased from 46px for better proportion)\n indicator: 'w-6 h-6', // 24px (20px + 4px progression)\n progressBar: 'h-0.5', // 2px maintained for consistency\n indicatorTextSize: '2xs', // 10px maintained for readability\n labelTextSize: 'xs', // 12px maintained\n iconSize: 'w-3.5 h-3.5', // 14px\n },\n large: {\n container: 'gap-4', // 16px (12px + 4px progression)\n stepWidth: 'w-[160px]', // 160px (increased from 140px to fit \"Endereço Residencial\")\n stepHeight: 'h-[58px]', // 58px (increased from 54px for better proportion)\n indicator: 'w-7 h-7', // 28px (24px + 4px progression)\n progressBar: 'h-1', // 4px (increased for better visibility)\n indicatorTextSize: 'xs', // 12px (increased for larger size)\n labelTextSize: 'sm', // 14px (increased for larger size)\n iconSize: 'w-4 h-4', // 16px\n },\n extraLarge: {\n container: 'gap-5', // 20px (16px + 4px progression)\n stepWidth: 'w-[200px]', // 200px (increased from 180px to ensure \"Endereço Residencial\" fits)\n stepHeight: 'h-[68px]', // 68px (increased from 62px for better proportion)\n indicator: 'w-8 h-8', // 32px (28px + 4px progression)\n progressBar: 'h-1', // 4px maintained\n indicatorTextSize: 'xs', // 12px maintained for readability\n labelTextSize: 'sm', // 14px maintained\n iconSize: 'w-[18px] h-[18px]', // 18px\n },\n} as const;\n\n/**\n * State configurations using exact colors from CSS specs\n * pending: #A3A3A3 = text-400 (etapa ainda não iniciada)\n * current: #1C61B2 = primary-800 (etapa atual sendo preenchida) - baseado no CSS fornecido\n * completed: #1C61B2 = primary-800 (etapa concluída)\n * text color: #FEFEFF = text\n */\nconst STATE_CLASSES = {\n pending: {\n progressBar: 'bg-text-400', // #A3A3A3\n indicator: 'bg-text-400', // #A3A3A3\n indicatorText: 'text-white', // Branco para contraste com background cinza\n label: 'text-text-400', // #A3A3A3\n },\n current: {\n progressBar: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicator: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-800', // #1C61B2 usando classe Tailwind padrão\n },\n completed: {\n progressBar: 'bg-primary-400', // #48A0E8 para barra quando checked (completed)\n indicator: 'bg-primary-400', // #48A0E8 para corresponder à barra de progresso\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-400', // #48A0E8 para corresponder à barra de progresso\n },\n} as const;\n\n/**\n * Type for size classes\n */\ntype SizeClassType = (typeof SIZE_CLASSES)[keyof typeof SIZE_CLASSES];\n\n/**\n * Type for state classes\n */\ntype StateClassType = (typeof STATE_CLASSES)[keyof typeof STATE_CLASSES];\n\n/**\n * Props for individual step component\n */\ninterface StepProps {\n step: StepData;\n index: number;\n size: StepperSize;\n sizeClasses: SizeClassType;\n stateClasses: StateClassType;\n isLast: boolean;\n className?: string;\n}\n\n/**\n * Individual Step component - Based on exact design specifications\n * Layout: flex-column with progress bar at top, then icon+label row\n * Fully responsive for mobile, tablets, and laptops\n */\nexport const Step = ({\n step,\n index,\n size: _size,\n sizeClasses,\n stateClasses,\n isLast: _isLast,\n className = '',\n}: StepProps) => {\n const stepNumber = index + 1;\n const isCompleted = step.state === 'completed';\n\n // Generate accessible aria-label based on step state\n const getAriaLabel = () => {\n let suffix = '';\n if (step.state === 'completed') {\n suffix = ' (concluído)';\n } else if (step.state === 'current') {\n suffix = ' (atual)';\n }\n return `${step.label}${suffix}`;\n };\n\n return (\n <div\n className={`\n flex flex-col justify-center items-center pb-2 gap-2\n ${sizeClasses.stepWidth} ${sizeClasses.stepHeight}\n flex-none flex-grow\n ${className}\n sm:max-w-[100px] md:max-w-[120px] lg:max-w-none xl:max-w-none\n sm:min-h-[40px] md:min-h-[45px] lg:min-h-none\n overflow-visible\n `}\n >\n {/* Progress Bar - Full width at top with responsive scaling */}\n <div\n className={`\n w-full ${sizeClasses.progressBar} ${stateClasses.progressBar}\n rounded-sm flex-none\n `}\n />\n\n {/* Step Content Container - Responsive layout for all devices, no vertical scroll */}\n <div\n className={`\n flex flex-col sm:flex-row items-center\n gap-1 sm:gap-2 w-full sm:w-auto\n h-auto sm:h-5 flex-none\n overflow-visible\n `}\n >\n {/* Step Indicator Circle with responsive sizing */}\n <div\n className={`\n ${sizeClasses.indicator} ${stateClasses.indicator}\n rounded-full flex items-center justify-center relative\n flex-none transition-all duration-300 ease-out\n w-4 h-4 sm:w-5 sm:h-5 md:w-5 md:h-5 lg:w-6 lg:h-6\n `}\n aria-label={getAriaLabel()}\n >\n {isCompleted ? (\n <Check\n weight=\"bold\"\n className={`\n ${stateClasses.indicatorText}\n w-2.5 h-2.5 sm:w-3 sm:h-3 md:w-3 md:h-3 lg:w-3.5 lg:h-3.5\n `}\n />\n ) : (\n <Text\n size={sizeClasses.indicatorTextSize as '2xs' | 'xs' | 'sm'}\n weight=\"medium\"\n color=\"\"\n className={`${stateClasses.indicatorText} leading-none text-2xs sm:text-xs`}\n >\n {stepNumber}\n </Text>\n )}\n </div>\n\n {/* Step Label with full responsive text sizing, no vertical overflow */}\n <Text\n size={sizeClasses.labelTextSize as '2xs' | 'xs' | 'sm' | 'md'}\n weight=\"medium\"\n color=\"\"\n className={`\n ${stateClasses.label} leading-tight flex-none\n text-center sm:text-left break-words\n px-1 sm:px-0 max-w-full\n text-2xs sm:text-xs md:text-xs lg:text-sm\n whitespace-normal\n `}\n >\n {step.label}\n </Text>\n </div>\n </div>\n );\n};\n\n/**\n * Stepper component props interface\n */\nexport type StepperProps = {\n /** Array of step data */\n steps: StepData[];\n /** Size variant of the stepper */\n size?: StepperSize;\n /** Current active step index */\n currentStep?: number;\n /** Additional CSS classes */\n className?: string;\n /** Step container CSS classes */\n stepClassName?: string;\n /** Progress indicator (e.g., \"Etapa 2 de 4\") */\n showProgress?: boolean;\n /** Custom progress text */\n progressText?: string;\n /** Make stepper responsive (vertical on mobile) */\n responsive?: boolean;\n};\n\n/**\n * Helper function to calculate step states based on current step\n */\nconst calculateStepStates = (\n steps: StepData[],\n currentStep: number\n): StepData[] => {\n return steps.map((step, index) => {\n let stepState: StepState;\n\n if (index < currentStep) {\n stepState = 'completed';\n } else if (index === currentStep) {\n stepState = 'current';\n } else {\n stepState = 'pending';\n }\n\n return {\n ...step,\n state: stepState,\n };\n });\n};\n\n/**\n * Helper function to get progress text\n */\nconst getProgressText = (\n currentStep: number,\n totalSteps: number,\n customText?: string\n): string => {\n if (customText) return customText;\n return `Etapa ${currentStep + 1} de ${totalSteps}`;\n};\n\n/**\n * Stepper component for Analytica Ensino platforms\n *\n * A progress stepper component that displays a sequence of steps with different states.\n * Follows the exact design specifications with proper spacing, colors, and layout.\n * Fully responsive for mobile, tablets, and laptops.\n *\n * Design specifications:\n * - Based on exact CSS specifications from Figma design\n * - Fully responsive: mobile (320px+) -> tablets (640px+) -> laptops (1024px+)\n * - Progressive sizing with responsive breakpoints that adapt to device type\n * - Consistent gaps that scale with screen size and device capabilities\n * - Consistent color scheme: pending (gray), current (dark blue), completed (light blue)\n * - Responsive design with overflow scroll on smaller devices\n * - Optimized text sizing and layout for each device category\n *\n * @example\n * ```tsx\n * // Basic stepper - automatically responsive for all devices\n * <Stepper steps={steps} currentStep={1} />\n *\n * // Custom styling with full responsive behavior\n * <Stepper steps={steps} size=\"medium\" showProgress responsive />\n * ```\n */\nconst Stepper = ({\n steps: initialSteps,\n size = 'medium',\n currentStep,\n className = '',\n stepClassName = '',\n showProgress = false,\n progressText,\n responsive = true,\n}: StepperProps) => {\n const sizeClasses = SIZE_CLASSES[size];\n\n // Calculate steps with states if currentStep is provided\n const steps =\n currentStep !== undefined\n ? calculateStepStates(initialSteps, currentStep)\n : initialSteps;\n\n return (\n <fieldset\n className={`flex flex-col gap-4 sm:gap-5 md:gap-6 ${className} border-0 p-0 m-0`}\n >\n <legend className=\"absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0\">\n Stepper de formulário\n </legend>\n {/* Progress indicator with responsive text */}\n {showProgress && currentStep !== undefined && (\n <Text\n size=\"sm\"\n weight=\"medium\"\n className=\"text-text-600 text-center sm:text-left text-xs sm:text-sm\"\n >\n {getProgressText(currentStep, steps.length, progressText)}\n </Text>\n )}\n\n {/* Stepper container - Fully responsive for all devices with horizontal scroll only */}\n <div\n className={`\n flex items-center\n ${sizeClasses.container}\n ${\n responsive\n ? 'flex-row overflow-x-auto overflow-y-hidden scrollbar-hide justify-start sm:justify-center md:justify-center lg:justify-center'\n : 'flex-row justify-center'\n }\n px-2 sm:px-4 md:px-6 lg:px-0\n max-w-full min-w-0\n gap-2 sm:gap-3 md:gap-4 lg:gap-4\n `}\n role=\"tablist\"\n aria-label=\"Progress steps\"\n >\n {steps.map((step, index) => {\n const stateClasses = STATE_CLASSES[step.state];\n\n return (\n <Step\n key={step.id}\n step={step}\n index={index}\n size={size}\n sizeClasses={sizeClasses}\n stateClasses={stateClasses}\n isLast={index === steps.length - 1}\n className={stepClassName}\n />\n );\n })}\n </div>\n </fieldset>\n );\n};\n\nexport default Stepper;\n"],"mappings":";AA0HI;AA/CJ,IAAM,OAAO,CAA8B;AAAA,EACzC;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,MAAoB;AAClB,MAAI,cAAc;AAClB,MAAI,gBAAgB;AAGpB,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,IACP,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAEA,gBAAc,aAAa,IAAI,KAAK,aAAa;AAGjD,QAAM,iBAAiB;AAAA,IACrB,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,OAAO;AAAA,EACT;AAEA,kBAAgB,eAAe,MAAM,KAAK,eAAe;AAEzD,QAAM,cAAc;AACpB,QAAM,YAAY,MAAO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CAAyC,SAAS;AAAA,MAE7D;AAAA,wBAAAA,KAAC,YAAO,WAAU,2EAA0E,sCAE5F;AAAA,QAEC,gBAAgB,gBAAgB,UAC/B,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,QAAO;AAAA,YACP,WAAU;AAAA,YAET,0BAAgB,aAAa,MAAM,QAAQ,YAAY;AAAA;AAAA,QAC1D;AAAA,QAIF,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA;AAAA,YAEP,YAAY,SAAS;AAAA,YAErB,aACI,kIACA,yBACN;AAAA;AAAA;AAAA;AAAA;AAAA,YAKF,MAAK;AAAA,YACL,cAAW;AAAA,YAEV,gBAAM,IAAI,CAAC,MAAM,UAAU;AAC1B,oBAAM,eAAe,cAAc,KAAK,KAAK;AAE7C,qBACE,gBAAAA;AAAA,gBAAC;AAAA;AAAA,kBAEC;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA,QAAQ,UAAU,MAAM,SAAS;AAAA,kBACjC,WAAW;AAAA;AAAA,gBAPN,KAAK;AAAA,cAQZ;AAAA,YAEJ,CAAC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,kBAAQ;","names":["jsx"]}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/utils.ts","../../src/components/Text/Text.tsx","../../src/components/Stepper/Stepper.tsx"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import { ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';\nimport { cn } from '../../utils/utils';\n\n/**\n * Base text component props\n */\ntype BaseTextProps = {\n /** Content to be displayed */\n children?: ReactNode;\n /** Text size variant */\n size?:\n | '2xs'\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | '4xl'\n | '5xl'\n | '6xl';\n /** Font weight variant */\n weight?:\n | 'hairline'\n | 'light'\n | 'normal'\n | 'medium'\n | 'semibold'\n | 'bold'\n | 'extrabold'\n | 'black';\n /** Color variant - white for light backgrounds, black for dark backgrounds */\n color?: string;\n /** Additional CSS classes to apply */\n className?: string;\n};\n\n/**\n * Polymorphic text component props that ensures type safety based on the 'as' prop\n */\ntype TextProps<T extends ElementType = 'p'> = BaseTextProps & {\n /** HTML tag to render */\n as?: T;\n} & Omit<ComponentPropsWithoutRef<T>, keyof BaseTextProps>;\n\n/**\n * Text component for Analytica Ensino platforms\n *\n * A flexible polymorphic text component with multiple sizes, weights, and colors.\n * Automatically adapts to dark and light themes with full type safety.\n *\n * @param children - The content to display\n * @param size - The text size variant (2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl)\n * @param weight - The font weight variant (hairline, light, normal, medium, semibold, bold, extrabold, black)\n * @param color - The color variant - adapts to theme\n * @param as - The HTML tag to render - determines allowed attributes via TypeScript\n * @param className - Additional CSS classes\n * @param props - HTML attributes valid for the chosen tag only\n * @returns A styled text element with type-safe attributes\n *\n * @example\n * ```tsx\n * <Text size=\"lg\" weight=\"bold\" color=\"text-info-800\">\n * This is a large, bold text\n * </Text>\n *\n * <Text as=\"a\" href=\"/link\" target=\"_blank\">\n * Link with type-safe anchor attributes\n * </Text>\n *\n * <Text as=\"button\" onClick={handleClick} disabled>\n * Button with type-safe button attributes\n * </Text>\n * ```\n */\nconst Text = <T extends ElementType = 'p'>({\n children,\n size = 'md',\n weight = 'normal',\n color = 'text-text-950',\n as,\n className = '',\n ...props\n}: TextProps<T>) => {\n let sizeClasses = '';\n let weightClasses = '';\n\n // Text size classes mapping\n const sizeClassMap = {\n '2xs': 'text-2xs',\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-md',\n lg: 'text-lg',\n xl: 'text-xl',\n '2xl': 'text-2xl',\n '3xl': 'text-3xl',\n '4xl': 'text-4xl',\n '5xl': 'text-5xl',\n '6xl': 'text-6xl',\n } as const;\n\n sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;\n\n // Font weight classes mapping\n const weightClassMap = {\n hairline: 'font-hairline',\n light: 'font-light',\n normal: 'font-normal',\n medium: 'font-medium',\n semibold: 'font-semibold',\n bold: 'font-bold',\n extrabold: 'font-extrabold',\n black: 'font-black',\n } as const;\n\n weightClasses = weightClassMap[weight] ?? weightClassMap.normal;\n\n const baseClasses = 'font-primary';\n const Component = as ?? ('p' as ElementType);\n\n return (\n <Component\n className={cn(baseClasses, sizeClasses, weightClasses, color, className)}\n {...props}\n >\n {children}\n </Component>\n );\n};\n\nexport default Text;\n","import Text from '../Text/Text';\nimport { Check } from 'phosphor-react';\nimport { cn } from '../../utils/utils';\n\n/**\n * Stepper size variants\n */\ntype StepperSize = 'small' | 'medium' | 'large' | 'extraLarge';\n\n/**\n * Step state variants\n */\ntype StepState = 'pending' | 'current' | 'completed';\n\n/**\n * Individual step data interface\n */\nexport interface StepData {\n /** Unique identifier for the step */\n id: string;\n /** Label text for the step */\n label: string;\n /** Current state of the step */\n state: StepState;\n}\n\n/**\n * Size configurations - Following design system pattern from CSS specifications\n * Small size based on exact CSS: width 58px, height 38px, gap 8px\n */\nconst SIZE_CLASSES = {\n small: {\n container: 'gap-2', // 8px gap as specified in CSS\n stepWidth: 'w-[58px]', // exact 58px from CSS\n stepHeight: 'h-[38px]', // exact 38px from CSS\n indicator: 'w-5 h-5', // 20px as specified\n progressBar: 'h-0.5', // 2px as specified\n indicatorTextSize: '2xs', // 10px as specified\n labelTextSize: 'xs', // 12px as specified\n iconSize: 'w-3 h-3', // 12px\n },\n medium: {\n container: 'gap-3', // 12px (8px + 4px progression)\n stepWidth: 'w-[110px]', // 110px (increased from 90px to fit \"Endereço Residencial\")\n stepHeight: 'h-[48px]', // 48px (increased from 46px for better proportion)\n indicator: 'w-6 h-6', // 24px (20px + 4px progression)\n progressBar: 'h-0.5', // 2px maintained for consistency\n indicatorTextSize: '2xs', // 10px maintained for readability\n labelTextSize: 'xs', // 12px maintained\n iconSize: 'w-3.5 h-3.5', // 14px\n },\n large: {\n container: 'gap-4', // 16px (12px + 4px progression)\n stepWidth: 'w-[160px]', // 160px (increased from 140px to fit \"Endereço Residencial\")\n stepHeight: 'h-[58px]', // 58px (increased from 54px for better proportion)\n indicator: 'w-7 h-7', // 28px (24px + 4px progression)\n progressBar: 'h-1', // 4px (increased for better visibility)\n indicatorTextSize: 'xs', // 12px (increased for larger size)\n labelTextSize: 'sm', // 14px (increased for larger size)\n iconSize: 'w-4 h-4', // 16px\n },\n extraLarge: {\n container: 'gap-5', // 20px (16px + 4px progression)\n stepWidth: 'w-[200px]', // 200px (increased from 180px to ensure \"Endereço Residencial\" fits)\n stepHeight: 'h-[68px]', // 68px (increased from 62px for better proportion)\n indicator: 'w-8 h-8', // 32px (28px + 4px progression)\n progressBar: 'h-1', // 4px maintained\n indicatorTextSize: 'xs', // 12px maintained for readability\n labelTextSize: 'sm', // 14px maintained\n iconSize: 'w-[18px] h-[18px]', // 18px\n },\n} as const;\n\n/**\n * State configurations using exact colors from CSS specs\n * pending: #A3A3A3 = text-400 (etapa ainda não iniciada)\n * current: #1C61B2 = primary-800 (etapa atual sendo preenchida) - baseado no CSS fornecido\n * completed: #1C61B2 = primary-800 (etapa concluída)\n * text color: #FEFEFF = text\n */\nconst STATE_CLASSES = {\n pending: {\n progressBar: 'bg-text-400', // #A3A3A3\n indicator: 'bg-text-400', // #A3A3A3\n indicatorText: 'text-white', // Branco para contraste com background cinza\n label: 'text-text-400', // #A3A3A3\n },\n current: {\n progressBar: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicator: 'bg-primary-800', // #1C61B2 usando classe Tailwind padrão\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-800', // #1C61B2 usando classe Tailwind padrão\n },\n completed: {\n progressBar: 'bg-primary-400', // #48A0E8 para barra quando checked (completed)\n indicator: 'bg-primary-400', // #48A0E8 para corresponder à barra de progresso\n indicatorText: 'text-white', // Branco usando classe Tailwind padrão\n label: 'text-primary-400', // #48A0E8 para corresponder à barra de progresso\n },\n} as const;\n\n/**\n * Type for size classes\n */\ntype SizeClassType = (typeof SIZE_CLASSES)[keyof typeof SIZE_CLASSES];\n\n/**\n * Type for state classes\n */\ntype StateClassType = (typeof STATE_CLASSES)[keyof typeof STATE_CLASSES];\n\n/**\n * Props for individual step component\n */\ninterface StepProps {\n step: StepData;\n index: number;\n size: StepperSize;\n sizeClasses: SizeClassType;\n stateClasses: StateClassType;\n isLast: boolean;\n className?: string;\n}\n\n/**\n * Individual Step component - Based on exact design specifications\n * Layout: flex-column with progress bar at top, then icon+label row\n * Fully responsive for mobile, tablets, and laptops\n */\nexport const Step = ({\n step,\n index,\n size: _size,\n sizeClasses,\n stateClasses,\n isLast: _isLast,\n className = '',\n}: StepProps) => {\n const stepNumber = index + 1;\n const isCompleted = step.state === 'completed';\n\n // Generate accessible aria-label based on step state\n const getAriaLabel = () => {\n let suffix = '';\n if (step.state === 'completed') {\n suffix = ' (concluído)';\n } else if (step.state === 'current') {\n suffix = ' (atual)';\n }\n return `${step.label}${suffix}`;\n };\n\n return (\n <div\n className={`\n flex flex-col justify-center items-center pb-2 gap-2\n ${sizeClasses.stepWidth} ${sizeClasses.stepHeight}\n flex-none flex-grow\n ${className}\n sm:max-w-[100px] md:max-w-[120px] lg:max-w-none xl:max-w-none\n sm:min-h-[40px] md:min-h-[45px] lg:min-h-none\n overflow-visible\n `}\n >\n {/* Progress Bar - Full width at top with responsive scaling */}\n <div\n className={`\n w-full ${sizeClasses.progressBar} ${stateClasses.progressBar}\n rounded-sm flex-none\n `}\n />\n\n {/* Step Content Container - Responsive layout for all devices, no vertical scroll */}\n <div\n className={`\n flex flex-col sm:flex-row items-center\n gap-1 sm:gap-2 w-full sm:w-auto\n h-auto sm:h-5 flex-none\n overflow-visible\n `}\n >\n {/* Step Indicator Circle with responsive sizing */}\n <div\n className={`\n ${sizeClasses.indicator} ${stateClasses.indicator}\n rounded-full flex items-center justify-center relative\n flex-none transition-all duration-300 ease-out\n w-4 h-4 sm:w-5 sm:h-5 md:w-5 md:h-5 lg:w-6 lg:h-6\n `}\n aria-label={getAriaLabel()}\n >\n {isCompleted ? (\n <Check\n weight=\"bold\"\n className={`\n ${stateClasses.indicatorText}\n w-2.5 h-2.5 sm:w-3 sm:h-3 md:w-3 md:h-3 lg:w-3.5 lg:h-3.5\n `}\n />\n ) : (\n <Text\n size={sizeClasses.indicatorTextSize as '2xs' | 'xs' | 'sm'}\n weight=\"medium\"\n color=\"\"\n className={cn(\n stateClasses.indicatorText,\n 'leading-none text-2xs sm:text-xs'\n )}\n >\n {stepNumber}\n </Text>\n )}\n </div>\n\n {/* Step Label with full responsive text sizing, no vertical overflow */}\n <Text\n size={sizeClasses.labelTextSize as '2xs' | 'xs' | 'sm' | 'md'}\n weight=\"medium\"\n color=\"\"\n className={cn(\n stateClasses.label,\n 'leading-tight flex-none text-center sm:text-left break-words px-1 sm:px-0 max-w-full text-2xs sm:text-xs md:text-xs lg:text-sm whitespace-normal'\n )}\n >\n {step.label}\n </Text>\n </div>\n </div>\n );\n};\n\n/**\n * Stepper component props interface\n */\nexport type StepperProps = {\n /** Array of step data */\n steps: StepData[];\n /** Size variant of the stepper */\n size?: StepperSize;\n /** Current active step index */\n currentStep?: number;\n /** Additional CSS classes */\n className?: string;\n /** Step container CSS classes */\n stepClassName?: string;\n /** Progress indicator (e.g., \"Etapa 2 de 4\") */\n showProgress?: boolean;\n /** Custom progress text */\n progressText?: string;\n /** Make stepper responsive (vertical on mobile) */\n responsive?: boolean;\n};\n\n/**\n * Helper function to calculate step states based on current step\n */\nconst calculateStepStates = (\n steps: StepData[],\n currentStep: number\n): StepData[] => {\n return steps.map((step, index) => {\n let stepState: StepState;\n\n if (index < currentStep) {\n stepState = 'completed';\n } else if (index === currentStep) {\n stepState = 'current';\n } else {\n stepState = 'pending';\n }\n\n return {\n ...step,\n state: stepState,\n };\n });\n};\n\n/**\n * Helper function to get progress text\n */\nconst getProgressText = (\n currentStep: number,\n totalSteps: number,\n customText?: string\n): string => {\n if (customText) return customText;\n return `Etapa ${currentStep + 1} de ${totalSteps}`;\n};\n\n/**\n * Stepper component for Analytica Ensino platforms\n *\n * A progress stepper component that displays a sequence of steps with different states.\n * Follows the exact design specifications with proper spacing, colors, and layout.\n * Fully responsive for mobile, tablets, and laptops.\n *\n * Design specifications:\n * - Based on exact CSS specifications from Figma design\n * - Fully responsive: mobile (320px+) -> tablets (640px+) -> laptops (1024px+)\n * - Progressive sizing with responsive breakpoints that adapt to device type\n * - Consistent gaps that scale with screen size and device capabilities\n * - Consistent color scheme: pending (gray), current (dark blue), completed (light blue)\n * - Responsive design with overflow scroll on smaller devices\n * - Optimized text sizing and layout for each device category\n *\n * @example\n * ```tsx\n * // Basic stepper - automatically responsive for all devices\n * <Stepper steps={steps} currentStep={1} />\n *\n * // Custom styling with full responsive behavior\n * <Stepper steps={steps} size=\"medium\" showProgress responsive />\n * ```\n */\nconst Stepper = ({\n steps: initialSteps,\n size = 'medium',\n currentStep,\n className = '',\n stepClassName = '',\n showProgress = false,\n progressText,\n responsive = true,\n}: StepperProps) => {\n const sizeClasses = SIZE_CLASSES[size];\n\n // Calculate steps with states if currentStep is provided\n const steps =\n currentStep !== undefined\n ? calculateStepStates(initialSteps, currentStep)\n : initialSteps;\n\n return (\n <fieldset\n className={cn(\n 'flex flex-col gap-4 sm:gap-5 md:gap-6',\n className,\n 'border-0 p-0 m-0'\n )}\n >\n <legend className=\"absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0\">\n Stepper de formulário\n </legend>\n {/* Progress indicator with responsive text */}\n {showProgress && currentStep !== undefined && (\n <Text\n size=\"sm\"\n weight=\"medium\"\n className=\"text-text-600 text-center sm:text-left text-xs sm:text-sm\"\n >\n {getProgressText(currentStep, steps.length, progressText)}\n </Text>\n )}\n\n {/* Stepper container - Fully responsive for all devices with horizontal scroll only */}\n <div\n className={cn(\n 'flex items-center',\n sizeClasses.container,\n responsive\n ? 'flex-row overflow-x-auto overflow-y-hidden scrollbar-hide justify-start sm:justify-center md:justify-center lg:justify-center'\n : 'flex-row justify-center',\n 'px-2 sm:px-4 md:px-6 lg:px-0 max-w-full min-w-0 gap-2 sm:gap-3 md:gap-4 lg:gap-4'\n )}\n role=\"tablist\"\n aria-label=\"Progress steps\"\n >\n {steps.map((step, index) => {\n const stateClasses = STATE_CLASSES[step.state];\n\n return (\n <Step\n key={step.id}\n step={step}\n index={index}\n size={size}\n sizeClasses={sizeClasses}\n stateClasses={stateClasses}\n isLast={index === steps.length - 1}\n className={stepClassName}\n />\n );\n })}\n </div>\n </fieldset>\n );\n};\n\nexport default Stepper;\n"],"mappings":";AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACsHI;AA/CJ,IAAM,OAAO,CAA8B;AAAA,EACzC;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA,YAAY;AAAA,EACZ,GAAG;AACL,MAAoB;AAClB,MAAI,cAAc;AAClB,MAAI,gBAAgB;AAGpB,QAAM,eAAe;AAAA,IACnB,OAAO;AAAA,IACP,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAEA,gBAAc,aAAa,IAAI,KAAK,aAAa;AAGjD,QAAM,iBAAiB;AAAA,IACrB,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,MAAM;AAAA,IACN,WAAW;AAAA,IACX,OAAO;AAAA,EACT;AAEA,kBAAgB,eAAe,MAAM,KAA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AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEA;AAAA,wBAAAA,KAAC,YAAO,WAAU,2EAA0E,sCAE5F;AAAA,QAEC,gBAAgB,gBAAgB,UAC/B,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,QAAO;AAAA,YACP,WAAU;AAAA,YAET,0BAAgB,aAAa,MAAM,QAAQ,YAAY;AAAA;AAAA,QAC1D;AAAA,QAIF,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,YAAY;AAAA,cACZ,aACI,kIACA;AAAA,cACJ;AAAA,YACF;AAAA,YACA,MAAK;AAAA,YACL,cAAW;AAAA,YAEV,gBAAM,IAAI,CAAC,MAAM,UAAU;AAC1B,oBAAM,eAAe,cAAc,KAAK,KAAK;AAE7C,qBACE,gBAAAA;AAAA,gBAAC;AAAA;AAAA,kBAEC;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA,QAAQ,UAAU,MAAM,SAAS;AAAA,kBACjC,WAAW;AAAA;AAAA,gBAPN,KAAK;AAAA,cAQZ;AAAA,YAEJ,CAAC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,kBAAQ;","names":["jsx"]}
|
package/dist/Table/index.js
CHANGED
|
@@ -31,13 +31,22 @@ __export(Table_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(Table_exports);
|
|
33
33
|
var import_react = require("react");
|
|
34
|
+
|
|
35
|
+
// src/utils/utils.ts
|
|
36
|
+
var import_clsx = require("clsx");
|
|
37
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
38
|
+
function cn(...inputs) {
|
|
39
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/components/Table/Table.tsx
|
|
34
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
44
|
var Table = (0, import_react.forwardRef)(
|
|
36
45
|
({ 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
46
|
"table",
|
|
38
47
|
{
|
|
39
48
|
ref,
|
|
40
|
-
className:
|
|
49
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
41
50
|
...props,
|
|
42
51
|
children: [
|
|
43
52
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
@@ -51,7 +60,7 @@ var TableHeader = (0, import_react.forwardRef)(({ className, ...props }, ref) =>
|
|
|
51
60
|
"thead",
|
|
52
61
|
{
|
|
53
62
|
ref,
|
|
54
|
-
className:
|
|
63
|
+
className: cn("[&_tr:first-child]:border-0", className),
|
|
55
64
|
...props
|
|
56
65
|
}
|
|
57
66
|
));
|
|
@@ -60,7 +69,10 @@ var TableBody = (0, import_react.forwardRef)(({ className, ...props }, ref) => /
|
|
|
60
69
|
"tbody",
|
|
61
70
|
{
|
|
62
71
|
ref,
|
|
63
|
-
className:
|
|
72
|
+
className: cn(
|
|
73
|
+
"[&_tr:last-child]:border-0 border-t border-border-200",
|
|
74
|
+
className
|
|
75
|
+
),
|
|
64
76
|
...props
|
|
65
77
|
}
|
|
66
78
|
));
|
|
@@ -69,7 +81,10 @@ var TableFooter = (0, import_react.forwardRef)(({ className, ...props }, ref) =>
|
|
|
69
81
|
"tfoot",
|
|
70
82
|
{
|
|
71
83
|
ref,
|
|
72
|
-
className:
|
|
84
|
+
className: cn(
|
|
85
|
+
"border-t bg-background-50 border-border-200 font-medium [&>tr]:last:border-b-0 px-6 py-3.5",
|
|
86
|
+
className
|
|
87
|
+
),
|
|
73
88
|
...props
|
|
74
89
|
}
|
|
75
90
|
));
|
|
@@ -86,12 +101,12 @@ var TableRow = (0, import_react.forwardRef)(
|
|
|
86
101
|
"tr",
|
|
87
102
|
{
|
|
88
103
|
ref,
|
|
89
|
-
className:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
className: cn(
|
|
105
|
+
"transition-colors",
|
|
106
|
+
state !== "disabled" ? "hover:bg-muted/50" : "",
|
|
107
|
+
VARIANT_STATES_ROW[state],
|
|
108
|
+
className
|
|
109
|
+
),
|
|
95
110
|
"aria-disabled": state === "disabled",
|
|
96
111
|
...props
|
|
97
112
|
}
|
|
@@ -103,7 +118,10 @@ var TableHead = (0, import_react.forwardRef)(({ className, ...props }, ref) => /
|
|
|
103
118
|
"th",
|
|
104
119
|
{
|
|
105
120
|
ref,
|
|
106
|
-
className:
|
|
121
|
+
className: cn(
|
|
122
|
+
"h-10 px-6 py-3.5 bg-muted/50 text-left align-middle font-bold text-text-800 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
123
|
+
className
|
|
124
|
+
),
|
|
107
125
|
...props
|
|
108
126
|
}
|
|
109
127
|
));
|
|
@@ -112,7 +130,10 @@ var TableCell = (0, import_react.forwardRef)(({ className, ...props }, ref) => /
|
|
|
112
130
|
"td",
|
|
113
131
|
{
|
|
114
132
|
ref,
|
|
115
|
-
className:
|
|
133
|
+
className: cn(
|
|
134
|
+
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-md text-text-800 px-6 py-3.5",
|
|
135
|
+
className
|
|
136
|
+
),
|
|
116
137
|
...props
|
|
117
138
|
}
|
|
118
139
|
));
|
|
@@ -121,7 +142,10 @@ var TableCaption = (0, import_react.forwardRef)(({ className, ...props }, ref) =
|
|
|
121
142
|
"caption",
|
|
122
143
|
{
|
|
123
144
|
ref,
|
|
124
|
-
className:
|
|
145
|
+
className: cn(
|
|
146
|
+
"border-t border-border-200 text-sm text-text-800 px-6 py-3.5",
|
|
147
|
+
className
|
|
148
|
+
),
|
|
125
149
|
...props
|
|
126
150
|
}
|
|
127
151
|
));
|
package/dist/Table/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Table/Table.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, TdHTMLAttributes } from 'react';\n\ntype TableRowState = 'default' | 'selected' | 'invalid' | 'disabled';\n\ninterface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n state?: TableRowState;\n}\n\nconst Table = forwardRef<HTMLTableElement, HTMLAttributes<HTMLTableElement>>(\n ({ className, children, ...props }, ref) => (\n <div className=\"border border-border-200 rounded-xl relative w-full overflow-hidden\">\n <table\n ref={ref}\n className={
|
|
1
|
+
{"version":3,"sources":["../../src/components/Table/Table.tsx","../../src/utils/utils.ts"],"sourcesContent":["import { forwardRef, HTMLAttributes, TdHTMLAttributes } from 'react';\nimport { cn } from '../../utils/utils';\n\ntype TableRowState = 'default' | 'selected' | 'invalid' | 'disabled';\n\ninterface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {\n state?: TableRowState;\n}\n\nconst Table = forwardRef<HTMLTableElement, HTMLAttributes<HTMLTableElement>>(\n ({ className, children, ...props }, ref) => (\n <div className=\"border border-border-200 rounded-xl relative w-full overflow-hidden\">\n <table\n ref={ref}\n className={cn('w-full caption-bottom text-sm', className)}\n {...props}\n >\n {/* Fix Sonnar */}\n <caption className=\"sr-only\">My Table</caption>\n {children}\n </table>\n </div>\n )\n);\n\nTable.displayName = 'Table';\n\nconst TableHeader = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <thead\n ref={ref}\n className={cn('[&_tr:first-child]:border-0', className)}\n {...props}\n />\n));\nTableHeader.displayName = 'TableHeader';\n\nconst TableBody = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody\n ref={ref}\n className={cn(\n '[&_tr:last-child]:border-0 border-t border-border-200',\n className\n )}\n {...props}\n />\n));\nTableBody.displayName = 'TableBody';\n\nconst TableFooter = forwardRef<\n HTMLTableSectionElement,\n HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn(\n 'border-t bg-background-50 border-border-200 font-medium [&>tr]:last:border-b-0 px-6 py-3.5',\n className\n )}\n {...props}\n />\n));\nTableFooter.displayName = 'TableFooter';\n\nconst VARIANT_STATES_ROW = {\n default: 'border-b border-border-200',\n selected: 'border-b-2 border-indicator-primary',\n invalid: 'border-b-2 border-indicator-error',\n disabled:\n 'border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed',\n} as const;\n\nconst TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(\n ({ state = 'default', className, ...props }, ref) => {\n return (\n <tr\n ref={ref}\n className={cn(\n 'transition-colors',\n state !== 'disabled' ? 'hover:bg-muted/50' : '',\n VARIANT_STATES_ROW[state],\n className\n )}\n aria-disabled={state === 'disabled'}\n {...props}\n />\n );\n }\n);\nTableRow.displayName = 'TableRow';\n\nconst TableHead = forwardRef<\n HTMLTableCellElement,\n TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n 'h-10 px-6 py-3.5 bg-muted/50 text-left align-middle font-bold text-text-800 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',\n className\n )}\n {...props}\n />\n));\nTableHead.displayName = 'TableHead';\n\nconst TableCell = forwardRef<\n HTMLTableCellElement,\n TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <td\n ref={ref}\n className={cn(\n 'p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-md text-text-800 px-6 py-3.5',\n className\n )}\n {...props}\n />\n));\nTableCell.displayName = 'TableCell';\n\nconst TableCaption = forwardRef<\n HTMLTableCaptionElement,\n HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption\n ref={ref}\n className={cn(\n 'border-t border-border-200 text-sm text-text-800 px-6 py-3.5',\n className\n )}\n {...props}\n />\n));\nTableCaption.displayName = 'TableCaption';\n\nexport default Table;\nexport {\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n};\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6D;;;ACA7D,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADOM;AAHN,IAAM,YAAQ;AAAA,EACZ,CAAC,EAAE,WAAW,UAAU,GAAG,MAAM,GAAG,QAClC,4CAAC,SAAI,WAAU,uEACb;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,iCAAiC,SAAS;AAAA,MACvD,GAAG;AAAA,MAGJ;AAAA,oDAAC,aAAQ,WAAU,WAAU,sBAAQ;AAAA,QACpC;AAAA;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,MAAM,cAAc;AAEpB,IAAM,kBAAc,yBAGlB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW,GAAG,+BAA+B,SAAS;AAAA,IACrD,GAAG;AAAA;AACN,CACD;AACD,YAAY,cAAc;AAE1B,IAAM,gBAAY,yBAGhB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;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