@stfrigerio/sito-template 0.1.30 → 0.1.31
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/components/atoms/LoadingSpinner/LoadingSpinner.d.ts +84 -0
- package/dist/components/atoms/LoadingSpinner/LoadingSpinner.d.ts.map +1 -0
- package/dist/components/atoms/LoadingSpinner/LoadingSpinner.stories.d.ts +23 -0
- package/dist/components/atoms/LoadingSpinner/LoadingSpinner.stories.d.ts.map +1 -0
- package/dist/components/atoms/LoadingSpinner/index.d.ts +3 -0
- package/dist/components/atoms/LoadingSpinner/index.d.ts.map +1 -0
- package/dist/components/atoms/index.d.ts +2 -0
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/organisms/charts/QuantifiableHabitsChart/QuantifiableHabitsChart.d.ts.map +1 -1
- package/dist/index.esm.js +275 -103
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +275 -102
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -30,7 +30,7 @@ const ThemeProvider = ({ children, defaultTheme = 'light' }) => {
|
|
|
30
30
|
return (jsx(ThemeContext$1.Provider, { value: { theme, toggleTheme, setTheme }, children: children }));
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
var styles$
|
|
33
|
+
var styles$s = {"button":"Button-module_button__c6nkW","primary":"Button-module_primary__pMqAs","secondary":"Button-module_secondary__mBWx9","outline":"Button-module_outline__NGGGN","ghost":"Button-module_ghost__u2QBF","danger":"Button-module_danger__2ewhr","small":"Button-module_small__ZI9RX","medium":"Button-module_medium__Wnf9t","large":"Button-module_large__cQCpA","fullWidth":"Button-module_fullWidth__N8vYg","loading":"Button-module_loading__hcSI4","spinner":"Button-module_spinner__HtM96","spin":"Button-module_spin__jblrj","iconLeft":"Button-module_iconLeft__Fpz-y","iconRight":"Button-module_iconRight__kTfjS"};
|
|
34
34
|
|
|
35
35
|
const SOUND_PACKS = {
|
|
36
36
|
digital: {
|
|
@@ -595,11 +595,11 @@ function useComponentSound(config, options) {
|
|
|
595
595
|
const Button = ({ variant = 'primary', size = 'medium', fullWidth = false, loading = false, iconLeft, iconRight, children, className = '', disabled, motionProps, soundConfig, onClick, onMouseEnter, onFocus, ...rest }) => {
|
|
596
596
|
const { handlers } = useComponentSound(soundConfig);
|
|
597
597
|
const buttonClasses = [
|
|
598
|
-
styles$
|
|
599
|
-
styles$
|
|
600
|
-
styles$
|
|
601
|
-
fullWidth && styles$
|
|
602
|
-
loading && styles$
|
|
598
|
+
styles$s.button,
|
|
599
|
+
styles$s[variant],
|
|
600
|
+
styles$s[size],
|
|
601
|
+
fullWidth && styles$s.fullWidth,
|
|
602
|
+
loading && styles$s.loading,
|
|
603
603
|
className
|
|
604
604
|
].filter(Boolean).join(' ');
|
|
605
605
|
const handleClick = (e) => {
|
|
@@ -610,10 +610,10 @@ const Button = ({ variant = 'primary', size = 'medium', fullWidth = false, loadi
|
|
|
610
610
|
handlers.onMouseEnter?.();
|
|
611
611
|
onMouseEnter?.(e);
|
|
612
612
|
};
|
|
613
|
-
return (jsxs(motion.button, { className: buttonClasses, disabled: disabled || loading, whileHover: { scale: disabled || loading ? 1 : 1.02 }, whileTap: { scale: disabled || loading ? 1 : 0.98 }, transition: { type: "spring", stiffness: 400, damping: 17 }, onClick: handleClick, onMouseEnter: handleMouseEnter, onFocus: onFocus, ...motionProps, ...rest, children: [loading && jsx("span", { className: styles$
|
|
613
|
+
return (jsxs(motion.button, { className: buttonClasses, disabled: disabled || loading, whileHover: { scale: disabled || loading ? 1 : 1.02 }, whileTap: { scale: disabled || loading ? 1 : 0.98 }, transition: { type: "spring", stiffness: 400, damping: 17 }, onClick: handleClick, onMouseEnter: handleMouseEnter, onFocus: onFocus, ...motionProps, ...rest, children: [loading && jsx("span", { className: styles$s.spinner }), iconLeft && jsx("span", { className: styles$s.iconLeft, children: iconLeft }), children, iconRight && jsx("span", { className: styles$s.iconRight, children: iconRight })] }));
|
|
614
614
|
};
|
|
615
615
|
|
|
616
|
-
var styles$
|
|
616
|
+
var styles$r = {"card":"Card-module_card__r2DB2","hoverable":"Card-module_hoverable__X3OpS","elevated":"Card-module_elevated__hGV6-","outlined":"Card-module_outlined__ngRag","flat":"Card-module_flat__xy-xt","glass":"Card-module_glass__Sv-Vs","imageContainer":"Card-module_imageContainer__L4ma6","image":"Card-module_image__bQBt6","header":"Card-module_header__0dtj3","headerContent":"Card-module_headerContent__W7-jD","expandButton":"Card-module_expandButton__I7f49","expandIcon":"Card-module_expandIcon__Lu-OY","expandableContent":"Card-module_expandableContent__BFgO5","expandable":"Card-module_expandable__GMXzo","body":"Card-module_body__K7eL3","footer":"Card-module_footer__L5wO-","title":"Card-module_title__pW9g8","subtitle":"Card-module_subtitle__gejH4","clickable":"Card-module_clickable__Y6fm8","padding":"Card-module_padding__wtyDo","noPadding":"Card-module_noPadding__r5Qq0","loading":"Card-module_loading__S4Wng","loadingShimmer":"Card-module_loadingShimmer__Q1Osr","loadingPulse":"Card-module_loadingPulse__bXQmC"};
|
|
617
617
|
|
|
618
618
|
/**
|
|
619
619
|
* Card Component
|
|
@@ -678,28 +678,28 @@ const Card = ({ variant = 'elevated', hoverable = false, clickable = false, padd
|
|
|
678
678
|
onExpandChange?.(newExpanded);
|
|
679
679
|
};
|
|
680
680
|
const cardClasses = [
|
|
681
|
-
styles$
|
|
682
|
-
styles$
|
|
683
|
-
hoverable && styles$
|
|
684
|
-
clickable && styles$
|
|
685
|
-
!padding && styles$
|
|
686
|
-
expandable && styles$
|
|
681
|
+
styles$r.card,
|
|
682
|
+
styles$r[variant],
|
|
683
|
+
hoverable && styles$r.hoverable,
|
|
684
|
+
clickable && styles$r.clickable,
|
|
685
|
+
!padding && styles$r.noPadding,
|
|
686
|
+
expandable && styles$r.expandable,
|
|
687
687
|
className
|
|
688
688
|
].filter(Boolean).join(' ');
|
|
689
689
|
const renderHeader = () => {
|
|
690
690
|
if (header) {
|
|
691
|
-
return (jsxs("div", { className: styles$
|
|
691
|
+
return (jsxs("div", { className: styles$r.header, children: [jsx("div", { className: styles$r.headerContent, children: header }), expandable && (jsx("button", { className: styles$r.expandButton, onClick: handleToggleExpand, "aria-label": isExpanded ? 'Collapse card' : 'Expand card', children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: styles$r.expandIcon, style: { transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)' }, children: jsx("path", { d: "M6 9l6 6 6-6" }) }) }))] }));
|
|
692
692
|
}
|
|
693
693
|
if (title || subtitle) {
|
|
694
|
-
return (jsxs("div", { className: styles$
|
|
694
|
+
return (jsxs("div", { className: styles$r.header, children: [jsxs("div", { className: styles$r.headerContent, children: [title && jsx("h3", { className: styles$r.title, children: title }), subtitle && jsx("p", { className: styles$r.subtitle, children: subtitle })] }), expandable && (jsx("button", { className: styles$r.expandButton, onClick: handleToggleExpand, "aria-label": isExpanded ? 'Collapse card' : 'Expand card', children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: styles$r.expandIcon, style: { transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)' }, children: jsx("path", { d: "M6 9l6 6 6-6" }) }) }))] }));
|
|
695
695
|
}
|
|
696
696
|
return null;
|
|
697
697
|
};
|
|
698
|
-
const cardContent = (jsxs(Fragment, { children: [image && (jsx("div", { className: styles$
|
|
698
|
+
const cardContent = (jsxs(Fragment, { children: [image && (jsx("div", { className: styles$r.imageContainer, children: jsx("img", { src: image, alt: imageAlt, className: styles$r.image }) })), renderHeader(), jsx(AnimatePresence, { initial: false, children: (!expandable || isExpanded) && (jsxs(motion.div, { initial: expandable ? { height: 0, opacity: 0 } : undefined, animate: expandable ? { height: 'auto', opacity: 1 } : undefined, exit: expandable ? { height: 0, opacity: 0 } : undefined, transition: { duration: 0.3, ease: "easeInOut" }, className: styles$r.expandableContent, children: [children && (jsx("div", { className: padding ? styles$r.body : undefined, children: children })), footer && jsx("div", { className: styles$r.footer, children: footer })] }, "content")) })] }));
|
|
699
699
|
return (jsx(motion.div, { className: cardClasses, onClick: clickable ? onClick : undefined, whileHover: hoverable ? { y: -4 } : undefined, transition: { type: "spring", stiffness: 400, damping: 17 }, ...motionProps, ...rest, children: cardContent }));
|
|
700
700
|
};
|
|
701
701
|
|
|
702
|
-
var styles$
|
|
702
|
+
var styles$q = {"checkboxLabel":"Checkbox-module_checkboxLabel__4tBVg","checkbox":"Checkbox-module_checkbox__BbJul","checkboxText":"Checkbox-module_checkboxText__oJsc9"};
|
|
703
703
|
|
|
704
704
|
/**
|
|
705
705
|
* Checkbox component - Modern interactive checkbox with animations
|
|
@@ -744,13 +744,13 @@ const Checkbox = ({ checked, onChange, label, disabled = false, indeterminate =
|
|
|
744
744
|
checkboxRef.current.indeterminate = indeterminate;
|
|
745
745
|
}
|
|
746
746
|
}, [indeterminate]);
|
|
747
|
-
return (jsxs("label", { className: styles$
|
|
747
|
+
return (jsxs("label", { className: styles$q.checkboxLabel, children: [jsx("input", { ref: checkboxRef, type: "checkbox", checked: checked, onChange: (e) => {
|
|
748
748
|
const isChecked = e.target.checked;
|
|
749
749
|
onChange(isChecked);
|
|
750
750
|
if (soundConfig?.onClick !== false) {
|
|
751
751
|
playSound('toggle');
|
|
752
752
|
}
|
|
753
|
-
}, className: styles$
|
|
753
|
+
}, className: styles$q.checkbox, disabled: disabled, id: id, name: name, value: value, "aria-checked": indeterminate ? 'mixed' : checked }), label && jsx("span", { className: styles$q.checkboxText, children: label })] }));
|
|
754
754
|
};
|
|
755
755
|
|
|
756
756
|
var DefaultContext = {
|
|
@@ -887,7 +887,7 @@ const parseEuropeanDate = (dateString) => {
|
|
|
887
887
|
return '';
|
|
888
888
|
};
|
|
889
889
|
|
|
890
|
-
var styles$
|
|
890
|
+
var styles$p = {"dateInput":"DateInput-module_dateInput__54VPD","label":"DateInput-module_label__yDdUw","inputWrapper":"DateInput-module_inputWrapper__x-r1d","textInput":"DateInput-module_textInput__ToOSX","calendarButton":"DateInput-module_calendarButton__JzDGD","hiddenDateInput":"DateInput-module_hiddenDateInput__IWNg3","error":"DateInput-module_error__ieuPO","success":"DateInput-module_success__rPA93","loading":"DateInput-module_loading__1DAmD"};
|
|
891
891
|
|
|
892
892
|
/**
|
|
893
893
|
* DateInput component - European format date picker with manual input support
|
|
@@ -976,19 +976,19 @@ function DateInput({ label, value, onChange, placeholder = "25/12/2024", onFocus
|
|
|
976
976
|
}
|
|
977
977
|
};
|
|
978
978
|
const getClassName = () => {
|
|
979
|
-
const classes = [styles$
|
|
979
|
+
const classes = [styles$p.dateInput];
|
|
980
980
|
if (error)
|
|
981
|
-
classes.push(styles$
|
|
981
|
+
classes.push(styles$p.error);
|
|
982
982
|
if (success)
|
|
983
|
-
classes.push(styles$
|
|
983
|
+
classes.push(styles$p.success);
|
|
984
984
|
if (loading)
|
|
985
|
-
classes.push(styles$
|
|
985
|
+
classes.push(styles$p.loading);
|
|
986
986
|
return classes.join(' ');
|
|
987
987
|
};
|
|
988
|
-
return (jsxs("div", { className: getClassName(), children: [jsx("label", { className: styles$
|
|
988
|
+
return (jsxs("div", { className: getClassName(), children: [jsx("label", { className: styles$p.label, children: label }), jsxs("div", { className: styles$p.inputWrapper, children: [jsx("input", { type: "text", value: value.includes('-') ? formatDateToEuropean(value) : value, onChange: (e) => handleTextChange(e.target.value), onFocus: onFocus, onBlur: onBlur, placeholder: placeholder, className: styles$p.textInput, disabled: disabled || loading, ...handlers }), jsx("button", { type: "button", onClick: handleCalendarClick, className: styles$p.calendarButton, title: "Select date from calendar", disabled: disabled || loading, children: jsx(FiCalendar, {}) }), jsx("input", { ref: hiddenDateInputRef, type: "date", onChange: handleCalendarChange, className: styles$p.hiddenDateInput, tabIndex: -1, disabled: disabled || loading })] })] }));
|
|
989
989
|
}
|
|
990
990
|
|
|
991
|
-
var styles$
|
|
991
|
+
var styles$o = {"searchableDropdown":"SearchableDropdown-module_searchableDropdown__S2Nh5","dropdownTrigger":"SearchableDropdown-module_dropdownTrigger__dihdr","open":"SearchableDropdown-module_open__P7mRt","dropdownValue":"SearchableDropdown-module_dropdownValue__ydrc2","placeholder":"SearchableDropdown-module_placeholder__BwM2W","dropdownArrow":"SearchableDropdown-module_dropdownArrow__yd5fp","dropdownMenu":"SearchableDropdown-module_dropdownMenu__2Z5cc","dropdownSearch":"SearchableDropdown-module_dropdownSearch__NRk7j","searchInput":"SearchableDropdown-module_searchInput__VS2Hw","searchIcon":"SearchableDropdown-module_searchIcon__2vKFF","dropdownOptions":"SearchableDropdown-module_dropdownOptions__6YXqF","dropdownOption":"SearchableDropdown-module_dropdownOption__YwDr-","selected":"SearchableDropdown-module_selected__31JeB","highlighted":"SearchableDropdown-module_highlighted__P0bBq","checkIcon":"SearchableDropdown-module_checkIcon__YxowK","dropdownNoResults":"SearchableDropdown-module_dropdownNoResults__WW-Da","loading":"SearchableDropdown-module_loading__xlYf0"};
|
|
992
992
|
|
|
993
993
|
/**
|
|
994
994
|
* SearchableDropdown component - Modern filterable dropdown with animations
|
|
@@ -1093,23 +1093,23 @@ function SearchableDropdown({ label, value, onChange, options, placeholder = "Se
|
|
|
1093
1093
|
}
|
|
1094
1094
|
};
|
|
1095
1095
|
const getTriggerClassName = () => {
|
|
1096
|
-
const classes = [styles$
|
|
1096
|
+
const classes = [styles$o.dropdownTrigger];
|
|
1097
1097
|
if (isOpen)
|
|
1098
|
-
classes.push(styles$
|
|
1098
|
+
classes.push(styles$o.open);
|
|
1099
1099
|
if (loading)
|
|
1100
|
-
classes.push(styles$
|
|
1100
|
+
classes.push(styles$o.loading);
|
|
1101
1101
|
if (error)
|
|
1102
|
-
classes.push(styles$
|
|
1102
|
+
classes.push(styles$o.error);
|
|
1103
1103
|
return classes.join(' ');
|
|
1104
1104
|
};
|
|
1105
|
-
return (jsxs("div", { className: styles$
|
|
1105
|
+
return (jsxs("div", { className: styles$o.searchableDropdown, ref: dropdownRef, onKeyDown: handleKeyDown, children: [jsx("label", { children: label }), jsxs(motion.button, { type: "button", className: getTriggerClassName(), onClick: () => !disabled && !loading && setIsOpen(!isOpen), whileTap: { scale: disabled ? 1 : 0.98 }, style: { willChange: 'transform' }, disabled: disabled, children: [jsx("span", { className: `${styles$o.dropdownValue} ${!displayValue ? styles$o.placeholder : ''}`, children: displayValue || placeholder }), jsx(FiChevronDown, { className: styles$o.dropdownArrow })] }), jsx(AnimatePresence, { children: isOpen && (jsxs(motion.div, { className: styles$o.dropdownMenu, initial: { opacity: 0, y: -10, scale: 0.95 }, animate: { opacity: 1, y: 0, scale: 1 }, exit: { opacity: 0, y: -10, scale: 0.95 }, transition: { duration: 0.2, ease: "easeOut" }, children: [jsxs("div", { className: styles$o.dropdownSearch, children: [jsx(FiSearch, { className: styles$o.searchIcon }), jsx("input", { ref: inputRef, type: "text", className: styles$o.searchInput, placeholder: "Cerca...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), onClick: (e) => e.stopPropagation() })] }), jsxs("div", { className: styles$o.dropdownOptions, children: [allOptions.map((opt, index) => {
|
|
1106
1106
|
const isSelected = value === opt.value;
|
|
1107
1107
|
const isHighlighted = highlightedIndex === index;
|
|
1108
|
-
return (jsxs(motion.button, { type: "button", className: `${styles$
|
|
1109
|
-
}), allOptions.length === 0 && (jsx(motion.div, { className: styles$
|
|
1108
|
+
return (jsxs(motion.button, { type: "button", className: `${styles$o.dropdownOption} ${isSelected ? styles$o.selected : ''} ${isHighlighted ? styles$o.highlighted : ''}`, onClick: () => handleSelect(opt.value), onMouseEnter: () => setHighlightedIndex(index), initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { delay: index * 0.02 }, whileTap: { scale: 0.98 }, style: { willChange: 'transform' }, children: [jsx("span", { children: opt.label }), isSelected && jsx(FiCheck, { className: styles$o.checkIcon })] }, `${opt.value}-${index}`));
|
|
1109
|
+
}), allOptions.length === 0 && (jsx(motion.div, { className: styles$o.dropdownNoResults, initial: { opacity: 0 }, animate: { opacity: 1 }, children: "No results found" }))] })] })) })] }));
|
|
1110
1110
|
}
|
|
1111
1111
|
|
|
1112
|
-
var styles$
|
|
1112
|
+
var styles$n = {"selectInput":"SelectInput-module_selectInput__s6zEg","selectWrapper":"SelectInput-module_selectWrapper__Qr4pl","selectIcon":"SelectInput-module_selectIcon__9pjhf","error":"SelectInput-module_error__3WNJc","success":"SelectInput-module_success__WJ5ga","loading":"SelectInput-module_loading__n35N9"};
|
|
1113
1113
|
|
|
1114
1114
|
/**
|
|
1115
1115
|
* SelectInput component - Styled dropdown selector with flexible option format
|
|
@@ -1147,26 +1147,26 @@ var styles$m = {"selectInput":"SelectInput-module_selectInput__s6zEg","selectWra
|
|
|
1147
1147
|
function SelectInput({ label, value, onChange, options, placeholder = "Select...", disabled = false, error = false, success = false, loading = false, required = false, soundConfig }) {
|
|
1148
1148
|
const { handlers, playSound } = useComponentSound(soundConfig);
|
|
1149
1149
|
const getClassName = () => {
|
|
1150
|
-
const classes = [styles$
|
|
1150
|
+
const classes = [styles$n.selectInput];
|
|
1151
1151
|
if (error)
|
|
1152
|
-
classes.push(styles$
|
|
1152
|
+
classes.push(styles$n.error);
|
|
1153
1153
|
if (success)
|
|
1154
|
-
classes.push(styles$
|
|
1154
|
+
classes.push(styles$n.success);
|
|
1155
1155
|
if (loading)
|
|
1156
|
-
classes.push(styles$
|
|
1156
|
+
classes.push(styles$n.loading);
|
|
1157
1157
|
return classes.join(' ');
|
|
1158
1158
|
};
|
|
1159
|
-
return (jsxs("div", { className: getClassName(), children: [jsxs("label", { children: [label, required && jsx("span", { style: { color: 'var(--color-error)' }, children: " *" })] }), jsxs("div", { className: styles$
|
|
1159
|
+
return (jsxs("div", { className: getClassName(), children: [jsxs("label", { children: [label, required && jsx("span", { style: { color: 'var(--color-error)' }, children: " *" })] }), jsxs("div", { className: styles$n.selectWrapper, children: [jsxs("select", { value: value, onChange: e => {
|
|
1160
1160
|
playSound('click');
|
|
1161
1161
|
onChange(e.target.value);
|
|
1162
1162
|
}, disabled: disabled || loading, required: required, ...handlers, children: [jsx("option", { value: "", children: placeholder }), options.map(opt => {
|
|
1163
1163
|
const optionValue = typeof opt === 'string' ? opt : opt.value;
|
|
1164
1164
|
const optionLabel = typeof opt === 'string' ? opt : opt.label;
|
|
1165
1165
|
return (jsx("option", { value: optionValue, children: optionLabel }, optionValue));
|
|
1166
|
-
})] }), jsx(FiChevronDown, { className: styles$
|
|
1166
|
+
})] }), jsx(FiChevronDown, { className: styles$n.selectIcon })] })] }));
|
|
1167
1167
|
}
|
|
1168
1168
|
|
|
1169
|
-
var styles$
|
|
1169
|
+
var styles$m = {"textareaContainer":"TextArea-module_textareaContainer__AquFj","compact":"TextArea-module_compact__U5lPn","textareaLabel":"TextArea-module_textareaLabel__7Vmyx","requiredIndicator":"TextArea-module_requiredIndicator__3Fxyy","textareaInput":"TextArea-module_textareaInput__VCDZA","characterCount":"TextArea-module_characterCount__9FO5N","nearLimit":"TextArea-module_nearLimit__cUdnw","atLimit":"TextArea-module_atLimit__GoWCC","error":"TextArea-module_error__ciHgb","success":"TextArea-module_success__a0-xD","loading":"TextArea-module_loading__CSFBR","focusMode":"TextArea-module_focusMode__9A8U-"};
|
|
1170
1170
|
|
|
1171
1171
|
/**
|
|
1172
1172
|
* TextArea component - Multi-line text input with character counting
|
|
@@ -1201,38 +1201,38 @@ var styles$l = {"textareaContainer":"TextArea-module_textareaContainer__AquFj","
|
|
|
1201
1201
|
function TextArea({ label, value, onChange, rows = 5, placeholder = "", required = false, maxLength, disabled = false, error = false, success = false, loading = false, focusMode = false, compact = false, className = "" }) {
|
|
1202
1202
|
const textareaId = `textarea-${Math.random().toString(36).substr(2, 9)}`;
|
|
1203
1203
|
const getContainerClassName = () => {
|
|
1204
|
-
const classes = [styles$
|
|
1204
|
+
const classes = [styles$m.textareaContainer];
|
|
1205
1205
|
if (error)
|
|
1206
|
-
classes.push(styles$
|
|
1206
|
+
classes.push(styles$m.error);
|
|
1207
1207
|
if (success)
|
|
1208
|
-
classes.push(styles$
|
|
1208
|
+
classes.push(styles$m.success);
|
|
1209
1209
|
if (loading)
|
|
1210
|
-
classes.push(styles$
|
|
1210
|
+
classes.push(styles$m.loading);
|
|
1211
1211
|
if (focusMode)
|
|
1212
|
-
classes.push(styles$
|
|
1212
|
+
classes.push(styles$m.focusMode);
|
|
1213
1213
|
if (compact)
|
|
1214
|
-
classes.push(styles$
|
|
1214
|
+
classes.push(styles$m.compact);
|
|
1215
1215
|
if (className)
|
|
1216
1216
|
classes.push(className);
|
|
1217
1217
|
return classes.join(' ');
|
|
1218
1218
|
};
|
|
1219
1219
|
const getCharCountClassName = () => {
|
|
1220
1220
|
if (!maxLength)
|
|
1221
|
-
return styles$
|
|
1222
|
-
const classes = [styles$
|
|
1221
|
+
return styles$m.characterCount;
|
|
1222
|
+
const classes = [styles$m.characterCount];
|
|
1223
1223
|
const percentage = (value.length / maxLength) * 100;
|
|
1224
1224
|
if (percentage >= 100) {
|
|
1225
|
-
classes.push(styles$
|
|
1225
|
+
classes.push(styles$m.atLimit);
|
|
1226
1226
|
}
|
|
1227
1227
|
else if (percentage >= 80) {
|
|
1228
|
-
classes.push(styles$
|
|
1228
|
+
classes.push(styles$m.nearLimit);
|
|
1229
1229
|
}
|
|
1230
1230
|
return classes.join(' ');
|
|
1231
1231
|
};
|
|
1232
|
-
return (jsxs("div", { className: getContainerClassName(), children: [label && (jsxs("label", { htmlFor: textareaId, className: styles$
|
|
1232
|
+
return (jsxs("div", { className: getContainerClassName(), children: [label && (jsxs("label", { htmlFor: textareaId, className: styles$m.textareaLabel, children: [label, required && jsx("span", { className: styles$m.requiredIndicator, children: "*" })] })), jsx("textarea", { id: textareaId, value: value, onChange: (e) => onChange(e.target.value), rows: rows, placeholder: placeholder, maxLength: maxLength, className: styles$m.textareaInput, "aria-required": required, disabled: disabled || loading, "aria-invalid": error }), maxLength && (jsxs("div", { className: getCharCountClassName(), children: [jsx("span", { children: value.length }), jsx("span", { style: { opacity: 0.7 }, children: " / " }), jsx("span", { children: maxLength })] }))] }));
|
|
1233
1233
|
}
|
|
1234
1234
|
|
|
1235
|
-
var styles$
|
|
1235
|
+
var styles$l = {"textInput":"TextInput-module_textInput__b2LVM","required":"TextInput-module_required__7uLiM","inputError":"TextInput-module_inputError__QD0a-","errorMessage":"TextInput-module_errorMessage__nIDoQ","success":"TextInput-module_success__KbSS3","loading":"TextInput-module_loading__qXaca","withIcon":"TextInput-module_withIcon__-8swm","inputIcon":"TextInput-module_inputIcon__B4czN","withAction":"TextInput-module_withAction__JD3ku","actionButton":"TextInput-module_actionButton__zFJel"};
|
|
1236
1236
|
|
|
1237
1237
|
/**
|
|
1238
1238
|
* TextInput component - A versatile text input field with label and error handling
|
|
@@ -1269,21 +1269,21 @@ function TextInput({ label, value, onChange, type = "text", onBlur, placeholder,
|
|
|
1269
1269
|
const { handlers, playSound } = useComponentSound(soundConfig);
|
|
1270
1270
|
const prevValueRef = React.useRef(value);
|
|
1271
1271
|
const getContainerClassName = () => {
|
|
1272
|
-
const classes = [styles$
|
|
1272
|
+
const classes = [styles$l.textInput];
|
|
1273
1273
|
if (success)
|
|
1274
|
-
classes.push(styles$
|
|
1274
|
+
classes.push(styles$l.success);
|
|
1275
1275
|
if (loading)
|
|
1276
|
-
classes.push(styles$
|
|
1276
|
+
classes.push(styles$l.loading);
|
|
1277
1277
|
if (icon)
|
|
1278
|
-
classes.push(styles$
|
|
1278
|
+
classes.push(styles$l.withIcon);
|
|
1279
1279
|
if (actionButton)
|
|
1280
|
-
classes.push(styles$
|
|
1280
|
+
classes.push(styles$l.withAction);
|
|
1281
1281
|
return classes.join(' ');
|
|
1282
1282
|
};
|
|
1283
1283
|
React.useEffect(() => {
|
|
1284
1284
|
prevValueRef.current = value;
|
|
1285
1285
|
}, [value]);
|
|
1286
|
-
return (jsxs("div", { className: getContainerClassName(), children: [jsxs("label", { htmlFor: inputId, children: [label, required && jsx("span", { className: styles$
|
|
1286
|
+
return (jsxs("div", { className: getContainerClassName(), children: [jsxs("label", { htmlFor: inputId, children: [label, required && jsx("span", { className: styles$l.required, children: "*" })] }), jsxs("div", { style: { position: 'relative' }, children: [icon && jsx("div", { className: styles$l.inputIcon, children: icon }), jsx("input", { id: inputId, type: type, value: value, onChange: (e) => {
|
|
1287
1287
|
const newValue = e.target.value;
|
|
1288
1288
|
const oldValue = prevValueRef.current;
|
|
1289
1289
|
onChange(newValue);
|
|
@@ -1299,13 +1299,13 @@ function TextInput({ label, value, onChange, type = "text", onBlur, placeholder,
|
|
|
1299
1299
|
if (error && soundConfig?.onError) {
|
|
1300
1300
|
playSound(typeof soundConfig.onError === 'string' ? soundConfig.onError : 'error');
|
|
1301
1301
|
}
|
|
1302
|
-
}, onBlur: onBlur, placeholder: placeholder, className: error ? styles$
|
|
1302
|
+
}, onBlur: onBlur, placeholder: placeholder, className: error ? styles$l.inputError : '', "aria-invalid": !!error, "aria-describedby": error ? `${inputId}-error` : undefined, disabled: disabled || loading, maxLength: maxLength, autoComplete: autoComplete }), actionButton && (jsx("button", { type: "button", className: styles$l.actionButton, onClick: () => {
|
|
1303
1303
|
handlers.onClick?.();
|
|
1304
1304
|
actionButton.onClick();
|
|
1305
|
-
}, disabled: disabled || loading, children: actionButton.label }))] }), error && (jsx("span", { id: `${inputId}-error`, className: styles$
|
|
1305
|
+
}, disabled: disabled || loading, children: actionButton.label }))] }), error && (jsx("span", { id: `${inputId}-error`, className: styles$l.errorMessage, children: error }))] }));
|
|
1306
1306
|
}
|
|
1307
1307
|
|
|
1308
|
-
var styles$
|
|
1308
|
+
var styles$k = {"toggleContainer":"Toggle-module_toggleContainer__QxqQb","toggleButton":"Toggle-module_toggleButton__WUUf-","active":"Toggle-module_active__fX6Io"};
|
|
1309
1309
|
|
|
1310
1310
|
/**
|
|
1311
1311
|
* Toggle Component
|
|
@@ -1366,7 +1366,7 @@ function Toggle(props) {
|
|
|
1366
1366
|
justifyContent: 'center',
|
|
1367
1367
|
...style
|
|
1368
1368
|
};
|
|
1369
|
-
return (jsxs("div", { className: `${styles$
|
|
1369
|
+
return (jsxs("div", { className: `${styles$k.toggleContainer} ${className || ''}`, children: [jsxs(motion.button, { ref: leftButtonRef, className: `${styles$k.toggleButton} ${!isOn ? styles$k.active : ''}`, whileHover: { scale: 1.05 }, whileTap: { scale: 0.95 }, transition: { type: "spring", stiffness: 400, damping: 17 }, onClick: () => {
|
|
1370
1370
|
const element = leftButtonRef.current;
|
|
1371
1371
|
if (!isOn) {
|
|
1372
1372
|
// Already on left, celebration!
|
|
@@ -1382,7 +1382,7 @@ function Toggle(props) {
|
|
|
1382
1382
|
playSound('toggle', element || undefined);
|
|
1383
1383
|
}
|
|
1384
1384
|
onToggle(false);
|
|
1385
|
-
}, onMouseEnter: () => handlers.onMouseEnter?.(leftButtonRef.current || undefined), style: buttonStyle, children: [jsx(motion.div, { animate: { scale: !isOn ? 1.1 : 1, rotate: !isOn ? [0, -5, 5, 0] : 0 }, transition: { duration: 0.3 }, children: leftIcon }), leftLabel] }), jsxs(motion.button, { ref: rightButtonRef, className: `${styles$
|
|
1385
|
+
}, onMouseEnter: () => handlers.onMouseEnter?.(leftButtonRef.current || undefined), style: buttonStyle, children: [jsx(motion.div, { animate: { scale: !isOn ? 1.1 : 1, rotate: !isOn ? [0, -5, 5, 0] : 0 }, transition: { duration: 0.3 }, children: leftIcon }), leftLabel] }), jsxs(motion.button, { ref: rightButtonRef, className: `${styles$k.toggleButton} ${isOn ? styles$k.active : ''}`, whileHover: { scale: 1.05 }, whileTap: { scale: 0.95 }, transition: { type: "spring", stiffness: 400, damping: 17 }, onClick: () => {
|
|
1386
1386
|
const element = rightButtonRef.current;
|
|
1387
1387
|
if (isOn) {
|
|
1388
1388
|
// Already on right, celebration!
|
|
@@ -1401,7 +1401,7 @@ function Toggle(props) {
|
|
|
1401
1401
|
}, onMouseEnter: () => handlers.onMouseEnter?.(rightButtonRef.current || undefined), style: buttonStyle, children: [jsx(motion.div, { animate: { scale: isOn ? 1.1 : 1, rotate: isOn ? [0, 5, -5, 0] : 0 }, transition: { duration: 0.3 }, children: rightIcon }), rightLabel] })] }));
|
|
1402
1402
|
}
|
|
1403
1403
|
|
|
1404
|
-
var styles$
|
|
1404
|
+
var styles$j = {"container":"NumberStepper-module_container__WSGlU","header":"NumberStepper-module_header__qXI1Y","icon":"NumberStepper-module_icon__vHgsw","label":"NumberStepper-module_label__AYr3g","stepper":"NumberStepper-module_stepper__oQhTp","disabled":"NumberStepper-module_disabled__kGB-g","button":"NumberStepper-module_button__YcjRt","buttonIcon":"NumberStepper-module_buttonIcon__odXec","valueContainer":"NumberStepper-module_valueContainer__87w2D","valueWrapper":"NumberStepper-module_valueWrapper__TH65N","value":"NumberStepper-module_value__BxJeD","limits":"NumberStepper-module_limits__-UrRE","limit":"NumberStepper-module_limit__7nbIP","small":"NumberStepper-module_small__P-k96","large":"NumberStepper-module_large__Lz6lk","outlined":"NumberStepper-module_outlined__CIXv7","filled":"NumberStepper-module_filled__IxOg-","minimal":"NumberStepper-module_minimal__y47-W","custom":"NumberStepper-module_custom__XGSVg","vertical":"NumberStepper-module_vertical__nBcL7","pulse":"NumberStepper-module_pulse__51oUo"};
|
|
1405
1405
|
|
|
1406
1406
|
/**
|
|
1407
1407
|
* NumberStepper Component
|
|
@@ -1586,32 +1586,32 @@ const NumberStepper = ({ value, onChange, min = -Infinity, max = Infinity, step
|
|
|
1586
1586
|
setDisplayValue(finalValue);
|
|
1587
1587
|
}, [displayValue, min, max, step, onChange]);
|
|
1588
1588
|
const containerClasses = [
|
|
1589
|
-
styles$
|
|
1590
|
-
styles$
|
|
1591
|
-
styles$
|
|
1592
|
-
layout === 'vertical' && styles$
|
|
1593
|
-
disabled && styles$
|
|
1589
|
+
styles$j.container,
|
|
1590
|
+
styles$j[size],
|
|
1591
|
+
styles$j[variant],
|
|
1592
|
+
layout === 'vertical' && styles$j.vertical,
|
|
1593
|
+
disabled && styles$j.disabled,
|
|
1594
1594
|
className
|
|
1595
1595
|
].filter(Boolean).join(' ');
|
|
1596
1596
|
// Merge custom styles with hover states
|
|
1597
1597
|
const [isButtonHovered, setIsButtonHovered] = useState(null);
|
|
1598
1598
|
const isDecrementDisabled = disabled || value <= min;
|
|
1599
1599
|
const isIncrementDisabled = disabled || value >= max;
|
|
1600
|
-
const stepperContent = (jsxs("div", { className: styles$
|
|
1600
|
+
const stepperContent = (jsxs("div", { className: styles$j.stepper, style: customStyles.stepper, onKeyDown: handleKeyDown, tabIndex: disabled ? -1 : 0, ...handlers, children: [jsx(motion.button, { className: styles$j.button, style: {
|
|
1601
1601
|
...customStyles.button,
|
|
1602
1602
|
...(isButtonHovered === 'decrement' && customStyles.buttonHover)
|
|
1603
|
-
}, onMouseEnter: () => setIsButtonHovered('decrement'), onMouseLeave: () => setIsButtonHovered(null), onClick: handleDecrement, disabled: isDecrementDisabled, whileTap: !isDecrementDisabled ? { scale: 0.9 } : undefined, animate: isDecrementing ? { scale: [1, 1.2, 1] } : undefined, transition: { duration: 0.2 }, "aria-label": "Decrease value", children: customButtons.decrement || (showPlusMinus ? (jsx("span", { className: styles$
|
|
1603
|
+
}, onMouseEnter: () => setIsButtonHovered('decrement'), onMouseLeave: () => setIsButtonHovered(null), onClick: handleDecrement, disabled: isDecrementDisabled, whileTap: !isDecrementDisabled ? { scale: 0.9 } : undefined, animate: isDecrementing ? { scale: [1, 1.2, 1] } : undefined, transition: { duration: 0.2 }, "aria-label": "Decrease value", children: customButtons.decrement || (showPlusMinus ? (jsx("span", { className: styles$j.buttonIcon, style: customStyles.buttonIcon, children: "\u2212" })) : (jsx("svg", { className: styles$j.buttonIcon, style: customStyles.buttonIcon, viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M15 18L9 12L15 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }))) }), jsx("div", { className: styles$j.valueContainer, style: customStyles.valueContainer, children: jsx(AnimatePresence, { mode: "wait", children: jsx(motion.div, { initial: { y: isIncrementing ? 10 : isDecrementing ? -10 : 0, opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: isIncrementing ? -10 : isDecrementing ? 10 : 0, opacity: 0 }, transition: { duration: 0.15 }, className: styles$j.valueWrapper, children: jsx("input", { type: "text", className: styles$j.value, style: customStyles.value, value: displayValue, onChange: handleInputChange, onBlur: handleInputBlur, disabled: disabled, "aria-label": label || "Number input", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value }) }, value) }) }), jsx(motion.button, { className: styles$j.button, style: {
|
|
1604
1604
|
...customStyles.button,
|
|
1605
1605
|
...(isButtonHovered === 'increment' && customStyles.buttonHover)
|
|
1606
|
-
}, onMouseEnter: () => setIsButtonHovered('increment'), onMouseLeave: () => setIsButtonHovered(null), onClick: handleIncrement, disabled: isIncrementDisabled, whileTap: !isIncrementDisabled ? { scale: 0.9 } : undefined, animate: isIncrementing ? { scale: [1, 1.2, 1] } : undefined, transition: { duration: 0.2 }, "aria-label": "Increase value", children: customButtons.increment || (showPlusMinus ? (jsx("span", { className: styles$
|
|
1606
|
+
}, onMouseEnter: () => setIsButtonHovered('increment'), onMouseLeave: () => setIsButtonHovered(null), onClick: handleIncrement, disabled: isIncrementDisabled, whileTap: !isIncrementDisabled ? { scale: 0.9 } : undefined, animate: isIncrementing ? { scale: [1, 1.2, 1] } : undefined, transition: { duration: 0.2 }, "aria-label": "Increase value", children: customButtons.increment || (showPlusMinus ? (jsx("span", { className: styles$j.buttonIcon, style: customStyles.buttonIcon, children: "+" })) : (jsx("svg", { className: styles$j.buttonIcon, style: customStyles.buttonIcon, viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M9 18L15 12L9 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }))) })] }));
|
|
1607
1607
|
// For custom variant with horizontal layout, render differently
|
|
1608
1608
|
if (variant === 'custom' && (label || icon)) {
|
|
1609
|
-
return (jsxs("div", { className: containerClasses, style: { ...customStyles.container, display: 'flex', alignItems: 'center' }, children: [jsxs("div", { className: styles$
|
|
1609
|
+
return (jsxs("div", { className: containerClasses, style: { ...customStyles.container, display: 'flex', alignItems: 'center' }, children: [jsxs("div", { className: styles$j.header, style: { ...customStyles.header, flex: 1, marginBottom: 0 }, children: [icon && jsx("span", { className: styles$j.icon, style: customStyles.icon, children: icon }), label && jsx("label", { className: styles$j.label, style: customStyles.label, children: label })] }), stepperContent, !hideLimits && (min !== -Infinity || max !== Infinity) && (jsxs("div", { className: styles$j.limits, style: customStyles.limits, children: [jsx("span", { className: styles$j.limit, children: min !== -Infinity && `Min: ${min}` }), jsx("span", { className: styles$j.limit, children: max !== Infinity && `Max: ${max}` })] }))] }));
|
|
1610
1610
|
}
|
|
1611
|
-
return (jsxs("div", { className: containerClasses, style: customStyles.container, children: [(label || icon) && (jsxs("div", { className: styles$
|
|
1611
|
+
return (jsxs("div", { className: containerClasses, style: customStyles.container, children: [(label || icon) && (jsxs("div", { className: styles$j.header, style: customStyles.header, children: [icon && jsx("span", { className: styles$j.icon, style: customStyles.icon, children: icon }), label && jsx("label", { className: styles$j.label, style: customStyles.label, children: label })] })), stepperContent, !hideLimits && (min !== -Infinity || max !== Infinity) && (jsxs("div", { className: styles$j.limits, style: customStyles.limits, children: [jsx("span", { className: styles$j.limit, children: min !== -Infinity && `Min: ${min}` }), jsx("span", { className: styles$j.limit, children: max !== Infinity && `Max: ${max}` })] }))] }));
|
|
1612
1612
|
};
|
|
1613
1613
|
|
|
1614
|
-
var styles$
|
|
1614
|
+
var styles$i = {"button":"ToggleButton-module_button__DTuyY","background":"ToggleButton-module_background__NwfTp","content":"ToggleButton-module_content__NHqIN","iconWrapper":"ToggleButton-module_iconWrapper__yN4sP","icon":"ToggleButton-module_icon__r8juX","label":"ToggleButton-module_label__4mPJP","hideMobile":"ToggleButton-module_hideMobile__GFAc3","checkmark":"ToggleButton-module_checkmark__ZJwf-","ripple":"ToggleButton-module_ripple__2-faB","small":"ToggleButton-module_small__MhfoN","large":"ToggleButton-module_large__A3naL","default":"ToggleButton-module_default__q8QaZ","active":"ToggleButton-module_active__4DjlR","outlined":"ToggleButton-module_outlined__OtqJB","filled":"ToggleButton-module_filled__LySNn","ghost":"ToggleButton-module_ghost__9KXcb","active-primary":"ToggleButton-module_active-primary__vXMP7","active-secondary":"ToggleButton-module_active-secondary__9Ttdx","active-success":"ToggleButton-module_active-success__oi0rr","active-danger":"ToggleButton-module_active-danger__VUdxr","active-warning":"ToggleButton-module_active-warning__77nSu","animation-scale":"ToggleButton-module_animation-scale__j-3mJ","scaleAnimation":"ToggleButton-module_scaleAnimation__Ms1j2","animation-rotate":"ToggleButton-module_animation-rotate__pBmfc","rotateAnimation":"ToggleButton-module_rotateAnimation__xWZJ5","animation-flip":"ToggleButton-module_animation-flip__ErAbm","flipAnimation":"ToggleButton-module_flipAnimation__qwDTb","disabled":"ToggleButton-module_disabled__Gv5ji"};
|
|
1615
1615
|
|
|
1616
1616
|
/**
|
|
1617
1617
|
* ToggleButton Component
|
|
@@ -1650,18 +1650,18 @@ var styles$h = {"button":"ToggleButton-module_button__DTuyY","background":"Toggl
|
|
|
1650
1650
|
const ToggleButton = ({ active, onClick, icon, label, disabled = false, size = 'medium', variant = 'default', activeColor = 'primary', showCheckmark = false, animation = 'scale', className = '', style = {}, color, tooltip, hideLabelOnMobile = false, soundConfig }) => {
|
|
1651
1651
|
const { handlers, playSound } = useComponentSound(soundConfig);
|
|
1652
1652
|
const buttonClasses = [
|
|
1653
|
-
styles$
|
|
1654
|
-
styles$
|
|
1655
|
-
styles$
|
|
1656
|
-
active && styles$
|
|
1657
|
-
active && styles$
|
|
1658
|
-
disabled && styles$
|
|
1659
|
-
animation !== 'none' && styles$
|
|
1653
|
+
styles$i.button,
|
|
1654
|
+
styles$i[size],
|
|
1655
|
+
styles$i[variant],
|
|
1656
|
+
active && styles$i.active,
|
|
1657
|
+
active && styles$i[`active-${activeColor}`],
|
|
1658
|
+
disabled && styles$i.disabled,
|
|
1659
|
+
animation !== 'none' && styles$i[`animation-${animation}`],
|
|
1660
1660
|
className
|
|
1661
1661
|
].filter(Boolean).join(' ');
|
|
1662
1662
|
const labelClasses = [
|
|
1663
|
-
styles$
|
|
1664
|
-
hideLabelOnMobile && styles$
|
|
1663
|
+
styles$i.label,
|
|
1664
|
+
hideLabelOnMobile && styles$i.hideMobile
|
|
1665
1665
|
].filter(Boolean).join(' ');
|
|
1666
1666
|
const iconVariants = {
|
|
1667
1667
|
scale: {
|
|
@@ -1725,10 +1725,10 @@ const ToggleButton = ({ active, onClick, icon, label, disabled = false, size = '
|
|
|
1725
1725
|
return (jsxs(motion.button, { className: buttonClasses, style: dynamicStyle, onClick: () => {
|
|
1726
1726
|
playSound('toggle');
|
|
1727
1727
|
onClick();
|
|
1728
|
-
}, disabled: disabled, whileHover: !disabled ? { scale: 1.05 } : undefined, whileTap: !disabled ? { scale: 0.95 } : undefined, title: tooltip, "aria-pressed": active, "aria-label": label, ...handlers, children: [jsx(motion.div, { className: styles$
|
|
1728
|
+
}, disabled: disabled, whileHover: !disabled ? { scale: 1.05 } : undefined, whileTap: !disabled ? { scale: 0.95 } : undefined, title: tooltip, "aria-pressed": active, "aria-label": label, ...handlers, children: [jsx(motion.div, { className: styles$i.background, variants: backgroundVariants, initial: "inactive", animate: active ? "active" : "inactive" }), jsxs("div", { className: styles$i.content, children: [icon && (jsx(motion.div, { className: styles$i.iconWrapper, variants: iconVariants[animation], initial: "inactive", animate: active ? "active" : "inactive", transition: { duration: 0.3 }, children: typeof icon === 'string' ? (jsx("span", { className: styles$i.icon, children: icon })) : (jsx("div", { className: styles$i.icon, children: icon })) })), label && jsx("span", { className: labelClasses, children: label }), jsx(AnimatePresence, { children: showCheckmark && active && (jsx(motion.div, { className: styles$i.checkmark, variants: checkmarkVariants, initial: "hidden", animate: "visible", exit: "hidden", children: jsx("svg", { viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M20 6L9 17L4 12", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }) }) })) })] }), jsx(AnimatePresence, { children: active && (jsx(motion.div, { className: styles$i.ripple, initial: { scale: 0, opacity: 0.5 }, animate: { scale: 2, opacity: 0 }, exit: { scale: 0, opacity: 0 }, transition: { duration: 0.6 } })) })] }));
|
|
1729
1729
|
};
|
|
1730
1730
|
|
|
1731
|
-
var styles$
|
|
1731
|
+
var styles$h = {"slider":"Slider-module_slider__RD4G7","label":"Slider-module_label__j4H8M","sliderContainer":"Slider-module_sliderContainer__kQICC","track":"Slider-module_track__fQ-oP","fill":"Slider-module_fill__AYR4-","shimmer":"Slider-module_shimmer__271tL","input":"Slider-module_input__fqY-G","thumb":"Slider-module_thumb__yQJho","ripple":"Slider-module_ripple__gVS04","tooltip":"Slider-module_tooltip__ZubHR","tooltipArrow":"Slider-module_tooltipArrow__1aV9s","valueDisplay":"Slider-module_valueDisplay__V6caL","labelsContainer":"Slider-module_labelsContainer__F6ojF","labelItem":"Slider-module_labelItem__FuEaY","size-sm":"Slider-module_size-sm__Y2bmS","size-lg":"Slider-module_size-lg__RSnPf","disabled":"Slider-module_disabled__gxYoH","loading":"Slider-module_loading__6FkKb","loadingTrack":"Slider-module_loadingTrack__8ItT2","loadingIndicator":"Slider-module_loadingIndicator__Elydq"};
|
|
1732
1732
|
|
|
1733
1733
|
/**
|
|
1734
1734
|
* Slider component - A beautiful, animated range input
|
|
@@ -1816,16 +1816,16 @@ function Slider({ value, onChange, min = 0, max = 100, step = 1, label, showValu
|
|
|
1816
1816
|
setShowTooltipState(false);
|
|
1817
1817
|
};
|
|
1818
1818
|
const dynamicColor = getDynamicColor();
|
|
1819
|
-
const sizeClass = styles$
|
|
1820
|
-
const stateClass = disabled ? styles$
|
|
1819
|
+
const sizeClass = styles$h[`size-${size}`];
|
|
1820
|
+
const stateClass = disabled ? styles$h.disabled : loading ? styles$h.loading : '';
|
|
1821
1821
|
if (loading) {
|
|
1822
|
-
return (jsxs("div", { className: `${styles$
|
|
1822
|
+
return (jsxs("div", { className: `${styles$h.slider} ${sizeClass} ${styles$h.loading} ${className}`, style: style, children: [label && jsx("label", { className: styles$h.label, children: label }), jsx("div", { className: styles$h.loadingTrack, children: jsx(motion.div, { className: styles$h.loadingIndicator, animate: { x: ['-100%', '200%'] }, transition: {
|
|
1823
1823
|
repeat: Infinity,
|
|
1824
1824
|
duration: 1.5,
|
|
1825
1825
|
ease: "easeInOut"
|
|
1826
1826
|
} }) })] }));
|
|
1827
1827
|
}
|
|
1828
|
-
return (jsxs("div", { className: `${styles$
|
|
1828
|
+
return (jsxs("div", { className: `${styles$h.slider} ${sizeClass} ${stateClass} ${className}`, style: style, children: [label && (jsx(motion.label, { className: styles$h.label, initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3 }, children: label })), jsxs(motion.div, { className: styles$h.sliderContainer, ref: sliderRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, whileHover: { scale: 1.02 }, transition: { duration: 0.1 }, children: [jsx(motion.div, { className: styles$h.track, whileHover: { height: 8, marginTop: -1 }, transition: { duration: 0.1 }, children: jsx(motion.div, { className: styles$h.fill, style: {
|
|
1829
1829
|
width: `${percentage}%`,
|
|
1830
1830
|
backgroundColor: dynamicColor
|
|
1831
1831
|
}, initial: { width: 0 }, animate: { width: `${percentage}%` }, transition: {
|
|
@@ -1835,7 +1835,7 @@ function Slider({ value, onChange, min = 0, max = 100, step = 1, label, showValu
|
|
|
1835
1835
|
damping: 30
|
|
1836
1836
|
}, whileHover: {
|
|
1837
1837
|
boxShadow: `inset 0 0 0 1px rgba(255,255,255,0.2)`
|
|
1838
|
-
} }) }), jsx("input", { type: "range", min: min, max: max, step: step, value: value, onChange: handleChange, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, ...handlers, className: styles$
|
|
1838
|
+
} }) }), jsx("input", { type: "range", min: min, max: max, step: step, value: value, onChange: handleChange, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, ...handlers, className: styles$h.input, disabled: disabled, "aria-label": label }), jsx(motion.div, { className: styles$h.thumb, style: {
|
|
1839
1839
|
left: `${percentage}%`,
|
|
1840
1840
|
backgroundColor: dynamicColor,
|
|
1841
1841
|
borderColor: colors.thumb || dynamicColor
|
|
@@ -1852,14 +1852,14 @@ function Slider({ value, onChange, min = 0, max = 100, step = 1, label, showValu
|
|
|
1852
1852
|
}, whileHover: {
|
|
1853
1853
|
scale: 1.1,
|
|
1854
1854
|
transition: { duration: 0.1 }
|
|
1855
|
-
}, children: isDragging && (jsx(motion.div, { className: styles$
|
|
1855
|
+
}, children: isDragging && (jsx(motion.div, { className: styles$h.ripple, initial: { scale: 0, opacity: 0.6 }, animate: { scale: 2, opacity: 0 }, transition: { duration: 0.5 } })) }), jsx(AnimatePresence, { children: showTooltipState && (jsxs(motion.div, { className: styles$h.tooltip, style: {
|
|
1856
1856
|
left: `${percentage}%`,
|
|
1857
1857
|
backgroundColor: dynamicColor
|
|
1858
|
-
}, initial: { opacity: 0, y: 10, scale: 0.8 }, animate: { opacity: 1, y: 0, scale: 1 }, exit: { opacity: 0, y: 10, scale: 0.8 }, transition: { duration: 0.2 }, children: [tooltipContent ? tooltipContent(value) : formatValue(value), jsx("div", { className: styles$
|
|
1858
|
+
}, initial: { opacity: 0, y: 10, scale: 0.8 }, animate: { opacity: 1, y: 0, scale: 1 }, exit: { opacity: 0, y: 10, scale: 0.8 }, transition: { duration: 0.2 }, children: [tooltipContent ? tooltipContent(value) : formatValue(value), jsx("div", { className: styles$h.tooltipArrow, style: { borderTopColor: dynamicColor } })] })) })] }), showValue && (jsx(motion.div, { className: styles$h.valueDisplay, style: { color: dynamicColor }, initial: { scale: 0.8 }, animate: { scale: 1 }, transition: {
|
|
1859
1859
|
duration: 0.2,
|
|
1860
1860
|
type: "spring",
|
|
1861
1861
|
stiffness: 300
|
|
1862
|
-
}, children: formatValue(value) }, value)), labels.length > 0 && (jsx("div", { className: styles$
|
|
1862
|
+
}, children: formatValue(value) }, value)), labels.length > 0 && (jsx("div", { className: styles$h.labelsContainer, children: labels.map((labelConfig, index) => {
|
|
1863
1863
|
let position = 0;
|
|
1864
1864
|
if (labelConfig.position === 'start')
|
|
1865
1865
|
position = 0;
|
|
@@ -1867,7 +1867,7 @@ function Slider({ value, onChange, min = 0, max = 100, step = 1, label, showValu
|
|
|
1867
1867
|
position = 100;
|
|
1868
1868
|
else if (typeof labelConfig.position === 'number')
|
|
1869
1869
|
position = labelConfig.position;
|
|
1870
|
-
return (jsx(motion.div, { className: styles$
|
|
1870
|
+
return (jsx(motion.div, { className: styles$h.labelItem, style: {
|
|
1871
1871
|
left: `${position}%`,
|
|
1872
1872
|
color: labelConfig.color
|
|
1873
1873
|
}, initial: { opacity: 0, y: 5 }, animate: { opacity: 1, y: 0 }, transition: {
|
|
@@ -1880,6 +1880,171 @@ function Slider({ value, onChange, min = 0, max = 100, step = 1, label, showValu
|
|
|
1880
1880
|
}) }))] }));
|
|
1881
1881
|
}
|
|
1882
1882
|
|
|
1883
|
+
var styles$g = {"loadingContainer":"LoadingSpinner-module_loadingContainer__m5u51","fullScreen":"LoadingSpinner-module_fullScreen__TuAem","overlay":"LoadingSpinner-module_overlay__X7FTa","shimmer":"LoadingSpinner-module_shimmer__xw4AH","small":"LoadingSpinner-module_small__nq8A3","loadingText":"LoadingSpinner-module_loadingText__wWwna","medium":"LoadingSpinner-module_medium__3JC1S","large":"LoadingSpinner-module_large__4MvAc","dotsSpinner":"LoadingSpinner-module_dotsSpinner__PXtfs","dot1":"LoadingSpinner-module_dot1__5YKSi","dot2":"LoadingSpinner-module_dot2__l6Rbu","dot3":"LoadingSpinner-module_dot3__b9YPW","circleSpinner":"LoadingSpinner-module_circleSpinner__ZmmWs","pulseSpinner":"LoadingSpinner-module_pulseSpinner__wTtDJ","textGradient":"LoadingSpinner-module_textGradient__QDrTY","sparkleContainer":"LoadingSpinner-module_sparkleContainer__9XLJG","sparkle":"LoadingSpinner-module_sparkle__LtFFf"};
|
|
1884
|
+
|
|
1885
|
+
const defaultMessages = [
|
|
1886
|
+
'Loading your content...',
|
|
1887
|
+
'Just a moment please...',
|
|
1888
|
+
'Preparing something awesome...',
|
|
1889
|
+
'Almost ready...',
|
|
1890
|
+
'Working on it...',
|
|
1891
|
+
'Just a sec...',
|
|
1892
|
+
'Loading with care...',
|
|
1893
|
+
'Getting things ready...',
|
|
1894
|
+
'Almost there...',
|
|
1895
|
+
'Polishing the details...'
|
|
1896
|
+
];
|
|
1897
|
+
/**
|
|
1898
|
+
* LoadingSpinner Component
|
|
1899
|
+
*
|
|
1900
|
+
* @component
|
|
1901
|
+
* @description
|
|
1902
|
+
* A highly customizable, animated loading spinner component built with Framer Motion.
|
|
1903
|
+
* Supports multiple visual variants, sizes, custom messages, and advanced styling options.
|
|
1904
|
+
* Perfect for indicating loading states across different contexts in your application.
|
|
1905
|
+
*
|
|
1906
|
+
* Features:
|
|
1907
|
+
* - Multiple spinner variants (dots, spinner, pulse)
|
|
1908
|
+
* - Three size options (small, medium, large)
|
|
1909
|
+
* - Rotating or static messages
|
|
1910
|
+
* - Customizable colors and styling
|
|
1911
|
+
* - Full-screen overlay support
|
|
1912
|
+
* - Decorative sparkle effects
|
|
1913
|
+
* - Accessibility support (respects reduced motion preferences)
|
|
1914
|
+
* - Theme-aware styling
|
|
1915
|
+
*
|
|
1916
|
+
* @example
|
|
1917
|
+
* // Basic usage
|
|
1918
|
+
* <LoadingSpinner />
|
|
1919
|
+
*
|
|
1920
|
+
* @example
|
|
1921
|
+
* // With custom message and variant
|
|
1922
|
+
* <LoadingSpinner
|
|
1923
|
+
* variant="pulse"
|
|
1924
|
+
* message="Saving your changes..."
|
|
1925
|
+
* size="large"
|
|
1926
|
+
* />
|
|
1927
|
+
*
|
|
1928
|
+
* @example
|
|
1929
|
+
* // Full-screen overlay
|
|
1930
|
+
* <LoadingSpinner
|
|
1931
|
+
* fullScreen
|
|
1932
|
+
* overlay
|
|
1933
|
+
* message="Loading application..."
|
|
1934
|
+
* />
|
|
1935
|
+
*
|
|
1936
|
+
* @example
|
|
1937
|
+
* // Custom messages and styling
|
|
1938
|
+
* <LoadingSpinner
|
|
1939
|
+
* customMessages={['Processing...', 'Almost done...', 'Final touches...']}
|
|
1940
|
+
* color="#ff6b6b"
|
|
1941
|
+
* backgroundColor="#f8f9fa"
|
|
1942
|
+
* showSparkles={false}
|
|
1943
|
+
* />
|
|
1944
|
+
*
|
|
1945
|
+
* @param {LoadingSpinnerProps} props - The props for the LoadingSpinner component
|
|
1946
|
+
* @returns {JSX.Element} The rendered LoadingSpinner component
|
|
1947
|
+
*/
|
|
1948
|
+
const LoadingSpinner = ({ message, size = 'medium', variant = 'dots', className = '', showMessage = true, customMessages, messageRotationInterval = 2500, showSparkles = true, fullScreen = false, overlay = false, color, backgroundColor }) => {
|
|
1949
|
+
const messagesToUse = customMessages || defaultMessages;
|
|
1950
|
+
const [currentMessageIndex, setCurrentMessageIndex] = useState(0);
|
|
1951
|
+
const [currentMessage, setCurrentMessage] = useState(message || messagesToUse[0]);
|
|
1952
|
+
useEffect(() => {
|
|
1953
|
+
if (!message && showMessage) {
|
|
1954
|
+
const interval = setInterval(() => {
|
|
1955
|
+
setCurrentMessageIndex((prev) => (prev + 1) % messagesToUse.length);
|
|
1956
|
+
}, messageRotationInterval);
|
|
1957
|
+
return () => clearInterval(interval);
|
|
1958
|
+
}
|
|
1959
|
+
}, [message, showMessage, messagesToUse.length, messageRotationInterval]);
|
|
1960
|
+
useEffect(() => {
|
|
1961
|
+
if (!message && showMessage) {
|
|
1962
|
+
setCurrentMessage(messagesToUse[currentMessageIndex]);
|
|
1963
|
+
}
|
|
1964
|
+
}, [currentMessageIndex, message, messagesToUse, showMessage]);
|
|
1965
|
+
const containerClasses = [
|
|
1966
|
+
styles$g.loadingContainer,
|
|
1967
|
+
styles$g[size],
|
|
1968
|
+
styles$g[variant],
|
|
1969
|
+
fullScreen && styles$g.fullScreen,
|
|
1970
|
+
overlay && styles$g.overlay,
|
|
1971
|
+
className
|
|
1972
|
+
].filter(Boolean).join(' ');
|
|
1973
|
+
const customStyle = {
|
|
1974
|
+
...(color && { '--spinner-color': color }),
|
|
1975
|
+
...(backgroundColor && { '--spinner-background': backgroundColor }),
|
|
1976
|
+
};
|
|
1977
|
+
const renderDots = () => (jsxs(motion.div, { className: styles$g.dotsSpinner, animate: { rotate: 360 }, transition: {
|
|
1978
|
+
duration: 2,
|
|
1979
|
+
repeat: Infinity,
|
|
1980
|
+
ease: 'linear'
|
|
1981
|
+
}, children: [jsx(motion.div, { className: styles$g.dot1, animate: {
|
|
1982
|
+
scale: [1, 1.3, 1],
|
|
1983
|
+
y: [0, -6, 0]
|
|
1984
|
+
}, transition: {
|
|
1985
|
+
duration: 1.5,
|
|
1986
|
+
repeat: Infinity,
|
|
1987
|
+
ease: 'easeInOut',
|
|
1988
|
+
delay: 0
|
|
1989
|
+
} }), jsx(motion.div, { className: styles$g.dot2, animate: {
|
|
1990
|
+
scale: [1, 1.3, 1],
|
|
1991
|
+
y: [0, -6, 0]
|
|
1992
|
+
}, transition: {
|
|
1993
|
+
duration: 1.5,
|
|
1994
|
+
repeat: Infinity,
|
|
1995
|
+
ease: 'easeInOut',
|
|
1996
|
+
delay: 0.5
|
|
1997
|
+
} }), jsx(motion.div, { className: styles$g.dot3, animate: {
|
|
1998
|
+
scale: [1, 1.3, 1],
|
|
1999
|
+
y: [0, -6, 0]
|
|
2000
|
+
}, transition: {
|
|
2001
|
+
duration: 1.5,
|
|
2002
|
+
repeat: Infinity,
|
|
2003
|
+
ease: 'easeInOut',
|
|
2004
|
+
delay: 1
|
|
2005
|
+
} })] }));
|
|
2006
|
+
const renderSpinner = () => (jsx(motion.div, { className: styles$g.circleSpinner, animate: { rotate: 360 }, transition: {
|
|
2007
|
+
duration: 1,
|
|
2008
|
+
repeat: Infinity,
|
|
2009
|
+
ease: 'linear'
|
|
2010
|
+
} }));
|
|
2011
|
+
const renderPulse = () => (jsx(motion.div, { className: styles$g.pulseSpinner, animate: {
|
|
2012
|
+
scale: [1, 1.2, 1],
|
|
2013
|
+
opacity: [1, 0.7, 1]
|
|
2014
|
+
}, transition: {
|
|
2015
|
+
duration: 1.5,
|
|
2016
|
+
repeat: Infinity,
|
|
2017
|
+
ease: 'easeInOut'
|
|
2018
|
+
} }));
|
|
2019
|
+
const renderSpinnerVariant = () => {
|
|
2020
|
+
switch (variant) {
|
|
2021
|
+
case 'spinner':
|
|
2022
|
+
return renderSpinner();
|
|
2023
|
+
case 'pulse':
|
|
2024
|
+
return renderPulse();
|
|
2025
|
+
case 'dots':
|
|
2026
|
+
default:
|
|
2027
|
+
return renderDots();
|
|
2028
|
+
}
|
|
2029
|
+
};
|
|
2030
|
+
return (jsxs("div", { className: containerClasses, style: customStyle, children: [renderSpinnerVariant(), showMessage && (jsx(AnimatePresence, { mode: "wait", children: jsx(motion.p, { className: styles$g.loadingText, initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -10 }, transition: {
|
|
2031
|
+
duration: 0.4,
|
|
2032
|
+
ease: 'easeOut'
|
|
2033
|
+
}, children: currentMessage }, currentMessage) })), showSparkles && (jsx("div", { className: styles$g.sparkleContainer, children: [...Array(4)].map((_, i) => (jsx(motion.div, { className: styles$g.sparkle, animate: {
|
|
2034
|
+
opacity: [0, 1, 0],
|
|
2035
|
+
scale: [0.5, 1, 0.5],
|
|
2036
|
+
rotate: [0, 180, 360]
|
|
2037
|
+
}, transition: {
|
|
2038
|
+
duration: 3,
|
|
2039
|
+
repeat: Infinity,
|
|
2040
|
+
delay: i * 0.75,
|
|
2041
|
+
ease: 'easeInOut'
|
|
2042
|
+
}, style: {
|
|
2043
|
+
left: `${20 + (i % 2) * 60}%`,
|
|
2044
|
+
top: `${20 + Math.floor(i / 2) * 60}%`
|
|
2045
|
+
} }, i))) }))] }));
|
|
2046
|
+
};
|
|
2047
|
+
|
|
1883
2048
|
var styles$f = {"arrayInput":"ArrayInput-module_arrayInput__q1x7A","arrayInputLabel":"ArrayInput-module_arrayInputLabel__HyUC7","arrayInputItem":"ArrayInput-module_arrayInputItem__bFtgl","inputWrapper":"ArrayInput-module_inputWrapper__ajhbW","input":"ArrayInput-module_input__1uywi","complexItem":"ArrayInput-module_complexItem__zr-Q-","fieldsWrapper":"ArrayInput-module_fieldsWrapper__7BVPa","removeButton":"ArrayInput-module_removeButton__gYf8Y","addButton":"ArrayInput-module_addButton__mia29"};
|
|
1884
2049
|
|
|
1885
2050
|
/**
|
|
@@ -2938,7 +3103,7 @@ const MoodChart = ({ moodData, width = 800, height = 400 }) => {
|
|
|
2938
3103
|
}, children: [jsxs("div", { className: styles$7.tooltipHeader, children: [jsx("div", { className: styles$7.tooltipDate, children: selectedMood.date.toLocaleDateString() }), jsxs("div", { className: styles$7.tooltipRating, children: [jsx("span", { className: styles$7.ratingValue, children: selectedMood.rating }), jsx("span", { className: styles$7.ratingMax, children: "/10" })] })] }), selectedMood.tags.length > 0 && (jsx("div", { className: styles$7.tooltipTags, children: selectedMood.tags.map((tag, index) => (jsx("span", { className: styles$7.tag, children: tag }, index))) })), selectedMood.comment && (jsx("div", { className: styles$7.tooltipComment, children: selectedMood.comment }))] }))] }));
|
|
2939
3104
|
};
|
|
2940
3105
|
|
|
2941
|
-
var styles$6 = {"container":"QuantifiableHabitsChart-module_container__X5SBp","controls":"QuantifiableHabitsChart-module_controls__O-ObQ","viewToggle":"QuantifiableHabitsChart-module_viewToggle__24hKA","viewButton":"QuantifiableHabitsChart-module_viewButton__WFU6j","active":"QuantifiableHabitsChart-module_active__Pjqy9","viewIcon":"QuantifiableHabitsChart-module_viewIcon__b2mfk","viewLabel":"QuantifiableHabitsChart-module_viewLabel__9MjCU","legend":"QuantifiableHabitsChart-module_legend__3Ki7c","legendItem":"QuantifiableHabitsChart-module_legendItem__Zl7fz","inactive":"QuantifiableHabitsChart-module_inactive__TzZC-","legendColor":"QuantifiableHabitsChart-module_legendColor__zbPoV","legendEmoji":"QuantifiableHabitsChart-module_legendEmoji__HG9CZ","legendLabel":"QuantifiableHabitsChart-module_legendLabel__H3oFL","chart":"QuantifiableHabitsChart-module_chart__FMeA-","gridLine":"QuantifiableHabitsChart-module_gridLine__CTNIq","line":"QuantifiableHabitsChart-module_line__CpYip","xAxis":"QuantifiableHabitsChart-module_xAxis__lbgBG","yAxis":"QuantifiableHabitsChart-module_yAxis__Y6WeV","dataPoint":"QuantifiableHabitsChart-module_dataPoint__s8UMX","tooltip":"QuantifiableHabitsChart-module_tooltip__Fay8N","visible":"QuantifiableHabitsChart-module_visible__-KSJq","tooltipHeader":"QuantifiableHabitsChart-module_tooltipHeader__7Q2up","tooltipEmoji":"QuantifiableHabitsChart-module_tooltipEmoji__atV3T","tooltipDot":"QuantifiableHabitsChart-module_tooltipDot__YbdFh","tooltipInfo":"QuantifiableHabitsChart-module_tooltipInfo__XC7WF","tooltipDate":"QuantifiableHabitsChart-module_tooltipDate__6V6Xi","tooltipValue":"QuantifiableHabitsChart-module_tooltipValue__ldASB"};
|
|
3106
|
+
var styles$6 = {"container":"QuantifiableHabitsChart-module_container__X5SBp","controls":"QuantifiableHabitsChart-module_controls__O-ObQ","viewToggle":"QuantifiableHabitsChart-module_viewToggle__24hKA","viewButton":"QuantifiableHabitsChart-module_viewButton__WFU6j","active":"QuantifiableHabitsChart-module_active__Pjqy9","viewIcon":"QuantifiableHabitsChart-module_viewIcon__b2mfk","viewLabel":"QuantifiableHabitsChart-module_viewLabel__9MjCU","aggregationToggle":"QuantifiableHabitsChart-module_aggregationToggle__WnxwB","aggregationButton":"QuantifiableHabitsChart-module_aggregationButton__sGCxX","aggregationIcon":"QuantifiableHabitsChart-module_aggregationIcon__HIaEf","aggregationLabel":"QuantifiableHabitsChart-module_aggregationLabel__Yc-S-","legend":"QuantifiableHabitsChart-module_legend__3Ki7c","legendItem":"QuantifiableHabitsChart-module_legendItem__Zl7fz","inactive":"QuantifiableHabitsChart-module_inactive__TzZC-","legendColor":"QuantifiableHabitsChart-module_legendColor__zbPoV","legendEmoji":"QuantifiableHabitsChart-module_legendEmoji__HG9CZ","legendLabel":"QuantifiableHabitsChart-module_legendLabel__H3oFL","chart":"QuantifiableHabitsChart-module_chart__FMeA-","gridLine":"QuantifiableHabitsChart-module_gridLine__CTNIq","line":"QuantifiableHabitsChart-module_line__CpYip","xAxis":"QuantifiableHabitsChart-module_xAxis__lbgBG","yAxis":"QuantifiableHabitsChart-module_yAxis__Y6WeV","dataPoint":"QuantifiableHabitsChart-module_dataPoint__s8UMX","tooltip":"QuantifiableHabitsChart-module_tooltip__Fay8N","visible":"QuantifiableHabitsChart-module_visible__-KSJq","tooltipHeader":"QuantifiableHabitsChart-module_tooltipHeader__7Q2up","tooltipEmoji":"QuantifiableHabitsChart-module_tooltipEmoji__atV3T","tooltipDot":"QuantifiableHabitsChart-module_tooltipDot__YbdFh","tooltipInfo":"QuantifiableHabitsChart-module_tooltipInfo__XC7WF","tooltipDate":"QuantifiableHabitsChart-module_tooltipDate__6V6Xi","tooltipValue":"QuantifiableHabitsChart-module_tooltipValue__ldASB"};
|
|
2942
3107
|
|
|
2943
3108
|
// Default colors as fallback
|
|
2944
3109
|
const DEFAULT_HABIT_COLORS = {
|
|
@@ -2958,6 +3123,7 @@ const QuantifiableHabitsChart = ({ data, width = 800, height = 400, defaultViewT
|
|
|
2958
3123
|
const [activeHabits, setActiveHabits] = useState([]);
|
|
2959
3124
|
const [hoveredHabit, setHoveredHabit] = useState(null);
|
|
2960
3125
|
const [tooltipData, setTooltipData] = useState(null);
|
|
3126
|
+
const [aggregationMode, setAggregationMode] = useState('average');
|
|
2961
3127
|
const margin = { top: 20, right: 20, bottom: 50, left: 50 };
|
|
2962
3128
|
const chartWidth = width - margin.left - margin.right;
|
|
2963
3129
|
const chartHeight = height - margin.top - margin.bottom;
|
|
@@ -3047,12 +3213,17 @@ const QuantifiableHabitsChart = ({ data, width = 800, height = 400, defaultViewT
|
|
|
3047
3213
|
.filter(v => typeof v === 'number' && !isNaN(v));
|
|
3048
3214
|
if (values.length === 0)
|
|
3049
3215
|
return 0;
|
|
3050
|
-
// Calculate
|
|
3051
|
-
|
|
3216
|
+
// Calculate aggregation based on mode
|
|
3217
|
+
if (aggregationMode === 'sum') {
|
|
3218
|
+
return Math.round(values.reduce((sum, v) => sum + v, 0));
|
|
3219
|
+
}
|
|
3220
|
+
else { // average
|
|
3221
|
+
return Math.round(values.reduce((sum, v) => sum + v, 0) / values.length);
|
|
3222
|
+
}
|
|
3052
3223
|
});
|
|
3053
3224
|
});
|
|
3054
3225
|
return aggregated;
|
|
3055
|
-
}, [data, viewType, habits]);
|
|
3226
|
+
}, [data, viewType, habits, aggregationMode]);
|
|
3056
3227
|
const toggleHabit = (habit) => {
|
|
3057
3228
|
setActiveHabits(prev => prev.includes(habit)
|
|
3058
3229
|
? prev.filter(h => h !== habit)
|
|
@@ -3250,7 +3421,8 @@ const QuantifiableHabitsChart = ({ data, width = 800, height = 400, defaultViewT
|
|
|
3250
3421
|
monthly: { icon: '🗓️', label: 'Monthly' },
|
|
3251
3422
|
quarterly: { icon: '📊', label: 'Quarterly' }
|
|
3252
3423
|
};
|
|
3253
|
-
|
|
3424
|
+
const shouldShowAggregationToggle = viewType !== 'daily';
|
|
3425
|
+
return (jsxs("div", { className: styles$6.container, children: [jsxs("div", { className: styles$6.controls, children: [jsx("div", { className: styles$6.viewToggle, children: availableViewTypes.map(type => (jsxs("button", { className: `${styles$6.viewButton} ${viewType === type ? styles$6.active : ''}`, onClick: () => setViewType(type), title: viewTypeConfig[type].label, children: [jsx("span", { className: styles$6.viewIcon, children: viewTypeConfig[type].icon }), jsx("span", { className: styles$6.viewLabel, children: viewTypeConfig[type].label })] }, type))) }), shouldShowAggregationToggle && (jsxs("div", { className: styles$6.aggregationToggle, children: [jsxs("button", { className: `${styles$6.aggregationButton} ${aggregationMode === 'average' ? styles$6.active : ''}`, onClick: () => setAggregationMode('average'), title: "Show average values for each period", children: [jsx("span", { className: styles$6.aggregationIcon, children: "\uD83D\uDCCA" }), jsx("span", { className: styles$6.aggregationLabel, children: "Average" })] }), jsxs("button", { className: `${styles$6.aggregationButton} ${aggregationMode === 'sum' ? styles$6.active : ''}`, onClick: () => setAggregationMode('sum'), title: "Show total values for each period", children: [jsx("span", { className: styles$6.aggregationIcon, children: "\u2795" }), jsx("span", { className: styles$6.aggregationLabel, children: "Sum" })] })] }))] }), jsx("div", { className: styles$6.legend, children: habits.map(habit => (jsxs("button", { className: `${styles$6.legendItem} ${!activeHabits.includes(habit) ? styles$6.inactive : ''}`, onClick: () => toggleHabit(habit), onMouseEnter: () => setHoveredHabit(habit), onMouseLeave: () => setHoveredHabit(null), children: [jsx("span", { className: styles$6.legendEmoji, children: customHabitEmojis[habit] || '📊' }), jsx("span", { className: styles$6.legendColor, style: { backgroundColor: getColor(habit) } }), jsx("span", { className: styles$6.legendLabel, children: habit })] }, habit))) }), jsx("svg", { ref: svgRef, width: width, height: height, className: styles$6.chart }), tooltipData && (jsxs("div", { ref: tooltipRef, className: `${styles$6.tooltip} ${tooltipData ? styles$6.visible : ''}`, style: {
|
|
3254
3426
|
left: `${tooltipData.x}px`,
|
|
3255
3427
|
top: `${tooltipData.y - 80}px`
|
|
3256
3428
|
}, children: [jsxs("div", { className: styles$6.tooltipHeader, children: [jsx("span", { className: styles$6.tooltipEmoji, children: customHabitEmojis[tooltipData.habit] || '📊' }), jsx("span", { className: styles$6.tooltipDot, style: { backgroundColor: getColor(tooltipData.habit) } }), jsx("span", { children: tooltipData.habit })] }), jsxs("div", { className: styles$6.tooltipInfo, children: [jsx("div", { className: styles$6.tooltipDate, children: formatTooltipDate(tooltipData.date, viewType) }), jsxs("div", { className: styles$6.tooltipValue, children: [jsx("strong", { children: Math.round(tooltipData.value * 10) / 10 }), jsx("span", { style: { fontSize: '12px', fontWeight: 'normal', opacity: 0.6 }, children: "units" })] })] })] }))] }));
|
|
@@ -4884,5 +5056,5 @@ function formatValue(value) {
|
|
|
4884
5056
|
// Memoized Table component to prevent unnecessary re-renders
|
|
4885
5057
|
const Table = memo(TableComponent);
|
|
4886
5058
|
|
|
4887
|
-
export { ArrayInput, BooleansHeatmap, Button, Calendar, Card, Checkbox, DateInput, EditFAB, ImageSlideshow, MoodChart, Navbar, NumberStepper, PieChart, QuantifiableHabitsChart, SearchBar, SearchableDropdown, SelectInput, SleepChart, Slider, SunburstChart, Table, Tabs, TextArea, TextInput, ThemeProvider, ThemeSwitcher, TimeInput, Toggle, ToggleButton, soundManager, useComponentSound, useSound, useTheme$1 as useTheme };
|
|
5059
|
+
export { ArrayInput, BooleansHeatmap, Button, Calendar, Card, Checkbox, DateInput, EditFAB, ImageSlideshow, LoadingSpinner, MoodChart, Navbar, NumberStepper, PieChart, QuantifiableHabitsChart, SearchBar, SearchableDropdown, SelectInput, SleepChart, Slider, SunburstChart, Table, Tabs, TextArea, TextInput, ThemeProvider, ThemeSwitcher, TimeInput, Toggle, ToggleButton, soundManager, useComponentSound, useSound, useTheme$1 as useTheme };
|
|
4888
5060
|
//# sourceMappingURL=index.esm.js.map
|