@stfrigerio/sito-template 0.1.8 → 0.1.10
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/AllAtoms.stories.d.ts.map +1 -1
- package/dist/components/atoms/ArrayInput/ArrayInput.d.ts +5 -0
- package/dist/components/atoms/ArrayInput/ArrayInput.d.ts.map +1 -1
- package/dist/components/atoms/Card/Card.d.ts +8 -0
- package/dist/components/atoms/Card/Card.d.ts.map +1 -1
- package/dist/components/atoms/Card/Card.stories.d.ts +24 -0
- package/dist/components/atoms/Card/Card.stories.d.ts.map +1 -1
- package/dist/components/atoms/TextArea/TextArea.d.ts +4 -2
- package/dist/components/atoms/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/atoms/TextArea/TextArea.stories.d.ts +8 -8
- package/dist/components/atoms/TextArea/TextArea.stories.d.ts.map +1 -1
- package/dist/components/atoms/Toggle/Toggle.d.ts +4 -0
- package/dist/components/atoms/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/atoms/Toggle/Toggle.stories.d.ts +1 -0
- package/dist/components/atoms/Toggle/Toggle.stories.d.ts.map +1 -1
- package/dist/components/atoms/index.d.ts +0 -2
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/molecules/ArrayInput/ArrayInput.d.ts +105 -0
- package/dist/components/molecules/ArrayInput/ArrayInput.d.ts.map +1 -0
- package/dist/components/molecules/ArrayInput/ArrayInput.stories.d.ts +44 -0
- package/dist/components/molecules/ArrayInput/ArrayInput.stories.d.ts.map +1 -0
- package/dist/components/molecules/ArrayInput/index.d.ts +3 -0
- package/dist/components/molecules/ArrayInput/index.d.ts.map +1 -0
- package/dist/components/molecules/index.d.ts +2 -0
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/organisms/Calendar/Calendar.d.ts +105 -0
- package/dist/components/organisms/Calendar/Calendar.d.ts.map +1 -0
- package/dist/components/organisms/Calendar/Calendar.stories.d.ts +42 -0
- package/dist/components/organisms/Calendar/Calendar.stories.d.ts.map +1 -0
- package/dist/components/organisms/Calendar/index.d.ts +3 -0
- package/dist/components/organisms/Calendar/index.d.ts.map +1 -0
- package/dist/components/organisms/index.d.ts +2 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/index.esm.js +468 -230
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +468 -229
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +2 -3
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$o = {"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
|
/**
|
|
36
36
|
* Button Component
|
|
@@ -73,17 +73,17 @@ var styles$n = {"button":"Button-module_button__c6nkW","primary":"Button-module_
|
|
|
73
73
|
*/
|
|
74
74
|
const Button = ({ variant = 'primary', size = 'medium', fullWidth = false, loading = false, iconLeft, iconRight, children, className = '', disabled, motionProps, ...rest }) => {
|
|
75
75
|
const buttonClasses = [
|
|
76
|
-
styles$
|
|
77
|
-
styles$
|
|
78
|
-
styles$
|
|
79
|
-
fullWidth && styles$
|
|
80
|
-
loading && styles$
|
|
76
|
+
styles$o.button,
|
|
77
|
+
styles$o[variant],
|
|
78
|
+
styles$o[size],
|
|
79
|
+
fullWidth && styles$o.fullWidth,
|
|
80
|
+
loading && styles$o.loading,
|
|
81
81
|
className
|
|
82
82
|
].filter(Boolean).join(' ');
|
|
83
|
-
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 }, ...motionProps, ...rest, children: [loading && jsx("span", { className: styles$
|
|
83
|
+
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 }, ...motionProps, ...rest, children: [loading && jsx("span", { className: styles$o.spinner }), iconLeft && jsx("span", { className: styles$o.iconLeft, children: iconLeft }), children, iconRight && jsx("span", { className: styles$o.iconRight, children: iconRight })] }));
|
|
84
84
|
};
|
|
85
85
|
|
|
86
|
-
var styles$
|
|
86
|
+
var styles$n = {"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"};
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* Card Component
|
|
@@ -136,150 +136,40 @@ var styles$m = {"card":"Card-module_card__r2DB2","hoverable":"Card-module_hovera
|
|
|
136
136
|
* @param {CardProps} props - The props for the Card component
|
|
137
137
|
* @returns {JSX.Element} The rendered Card component
|
|
138
138
|
*/
|
|
139
|
-
const Card = ({ variant = 'elevated', hoverable = false, clickable = false, padding = true, image, imageAlt = '', title, subtitle, header, footer, children, className = '', onClick, motionProps, ...rest }) => {
|
|
139
|
+
const Card = ({ variant = 'elevated', hoverable = false, clickable = false, padding = true, image, imageAlt = '', title, subtitle, header, footer, children, expandable = false, defaultExpanded = false, expanded: controlledExpanded, onExpandChange, className = '', onClick, motionProps, ...rest }) => {
|
|
140
|
+
// State management for expandable cards
|
|
141
|
+
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
142
|
+
const isExpanded = controlledExpanded !== undefined ? controlledExpanded : internalExpanded;
|
|
143
|
+
const handleToggleExpand = () => {
|
|
144
|
+
const newExpanded = !isExpanded;
|
|
145
|
+
if (controlledExpanded === undefined) {
|
|
146
|
+
setInternalExpanded(newExpanded);
|
|
147
|
+
}
|
|
148
|
+
onExpandChange?.(newExpanded);
|
|
149
|
+
};
|
|
140
150
|
const cardClasses = [
|
|
141
|
-
styles$
|
|
142
|
-
styles$
|
|
143
|
-
hoverable && styles$
|
|
144
|
-
clickable && styles$
|
|
145
|
-
!padding && styles$
|
|
151
|
+
styles$n.card,
|
|
152
|
+
styles$n[variant],
|
|
153
|
+
hoverable && styles$n.hoverable,
|
|
154
|
+
clickable && styles$n.clickable,
|
|
155
|
+
!padding && styles$n.noPadding,
|
|
156
|
+
expandable && styles$n.expandable,
|
|
146
157
|
className
|
|
147
158
|
].filter(Boolean).join(' ');
|
|
148
|
-
const
|
|
159
|
+
const renderHeader = () => {
|
|
160
|
+
if (header) {
|
|
161
|
+
return (jsxs("div", { className: styles$n.header, children: [jsx("div", { className: styles$n.headerContent, children: header }), expandable && (jsx("button", { className: styles$n.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$n.expandIcon, style: { transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)' }, children: jsx("path", { d: "M6 9l6 6 6-6" }) }) }))] }));
|
|
162
|
+
}
|
|
163
|
+
if (title || subtitle) {
|
|
164
|
+
return (jsxs("div", { className: styles$n.header, children: [jsxs("div", { className: styles$n.headerContent, children: [title && jsx("h3", { className: styles$n.title, children: title }), subtitle && jsx("p", { className: styles$n.subtitle, children: subtitle })] }), expandable && (jsx("button", { className: styles$n.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$n.expandIcon, style: { transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)' }, children: jsx("path", { d: "M6 9l6 6 6-6" }) }) }))] }));
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
};
|
|
168
|
+
const cardContent = (jsxs(Fragment, { children: [image && (jsx("div", { className: styles$n.imageContainer, children: jsx("img", { src: image, alt: imageAlt, className: styles$n.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$n.expandableContent, children: [children && (jsx("div", { className: padding ? styles$n.body : undefined, children: children })), footer && jsx("div", { className: styles$n.footer, children: footer })] }, "content")) })] }));
|
|
149
169
|
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 }));
|
|
150
170
|
};
|
|
151
171
|
|
|
152
|
-
var styles$
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* TextInput component - A versatile text input field with label and error handling
|
|
156
|
-
*
|
|
157
|
-
* @component
|
|
158
|
-
* @description
|
|
159
|
-
* A foundational input component that provides a clean, accessible text field with
|
|
160
|
-
* built-in support for labels, validation errors, and various HTML5 input types.
|
|
161
|
-
* Follows design system tokens for consistent theming across light/dark modes.
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* // Basic usage
|
|
165
|
-
* <TextInput
|
|
166
|
-
* label="Email Address"
|
|
167
|
-
* value={email}
|
|
168
|
-
* onChange={setEmail}
|
|
169
|
-
* type="email"
|
|
170
|
-
* placeholder="Enter your email"
|
|
171
|
-
* />
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* // With validation error
|
|
175
|
-
* <TextInput
|
|
176
|
-
* label="Password"
|
|
177
|
-
* value={password}
|
|
178
|
-
* onChange={setPassword}
|
|
179
|
-
* type="password"
|
|
180
|
-
* error="Password must be at least 8 characters"
|
|
181
|
-
* required
|
|
182
|
-
* />
|
|
183
|
-
*/
|
|
184
|
-
function TextInput({ label, value, onChange, type = "text", onFocus, onBlur, placeholder, error, required, disabled = false, success = false, loading = false, icon, actionButton, maxLength, autoComplete }) {
|
|
185
|
-
const inputId = `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
186
|
-
const getContainerClassName = () => {
|
|
187
|
-
const classes = [styles$l.textInput];
|
|
188
|
-
if (success)
|
|
189
|
-
classes.push(styles$l.success);
|
|
190
|
-
if (loading)
|
|
191
|
-
classes.push(styles$l.loading);
|
|
192
|
-
if (icon)
|
|
193
|
-
classes.push(styles$l.withIcon);
|
|
194
|
-
if (actionButton)
|
|
195
|
-
classes.push(styles$l.withAction);
|
|
196
|
-
return classes.join(' ');
|
|
197
|
-
};
|
|
198
|
-
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) => onChange(e.target.value), onFocus: onFocus, 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: actionButton.onClick, disabled: disabled || loading, children: actionButton.label }))] }), error && (jsx("span", { id: `${inputId}-error`, className: styles$l.errorMessage, children: error }))] }));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
var styles$k = {"arrayInput":"ArrayInput-module_arrayInput__FNrd2","arrayInputLabel":"ArrayInput-module_arrayInputLabel__7Rpkj","arrayInputItem":"ArrayInput-module_arrayInputItem__eSH-6","inputWrapper":"ArrayInput-module_inputWrapper__i-MB-","input":"ArrayInput-module_input__792ru","complexItem":"ArrayInput-module_complexItem__iX3v6","fieldsWrapper":"ArrayInput-module_fieldsWrapper__fzqvn"};
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* ArrayInput component - Versatile dynamic list manager
|
|
205
|
-
*
|
|
206
|
-
* @component
|
|
207
|
-
* @description
|
|
208
|
-
* A flexible component that can handle both simple string arrays and complex object arrays.
|
|
209
|
-
* Users can add, remove, and edit items dynamically. Supports custom field configurations
|
|
210
|
-
* for complex data structures.
|
|
211
|
-
*
|
|
212
|
-
* @example
|
|
213
|
-
* // Simple string array
|
|
214
|
-
* <ArrayInput
|
|
215
|
-
* label="Tags"
|
|
216
|
-
* values={tags}
|
|
217
|
-
* onChange={setTags}
|
|
218
|
-
* placeholder="Enter tag"
|
|
219
|
-
* />
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
* // Complex object array
|
|
223
|
-
* <ArrayInput
|
|
224
|
-
* type="complex"
|
|
225
|
-
* label="Social Links"
|
|
226
|
-
* values={links}
|
|
227
|
-
* onChange={setLinks}
|
|
228
|
-
* fields={[
|
|
229
|
-
* { name: 'label', label: 'Label', placeholder: 'GitHub' },
|
|
230
|
-
* { name: 'url', label: 'URL', type: 'url', placeholder: 'https://github.com/...' }
|
|
231
|
-
* ]}
|
|
232
|
-
* />
|
|
233
|
-
*/
|
|
234
|
-
function ArrayInput(props) {
|
|
235
|
-
if (props.type === 'complex') {
|
|
236
|
-
return jsx(ComplexArrayInput, { ...props });
|
|
237
|
-
}
|
|
238
|
-
return jsx(SimpleArrayInput, { ...props });
|
|
239
|
-
}
|
|
240
|
-
// Simple string array implementation
|
|
241
|
-
function SimpleArrayInput({ label, values, onChange, placeholder }) {
|
|
242
|
-
const handleChange = (index, value) => {
|
|
243
|
-
const newValues = [...values];
|
|
244
|
-
newValues[index] = value;
|
|
245
|
-
onChange(newValues);
|
|
246
|
-
};
|
|
247
|
-
const handleAdd = () => {
|
|
248
|
-
onChange([...values, '']);
|
|
249
|
-
};
|
|
250
|
-
const handleRemove = (index) => {
|
|
251
|
-
const newValues = values.filter((_, i) => i !== index);
|
|
252
|
-
onChange(newValues);
|
|
253
|
-
};
|
|
254
|
-
return (jsxs("div", { className: styles$k.arrayInput, children: [jsx("h3", { className: styles$k.arrayInputLabel, children: label }), values.map((value, index) => (jsxs("div", { className: styles$k.arrayInputItem, children: [jsx("div", { className: styles$k.inputWrapper, children: jsx("input", { type: "text", value: value, onChange: (e) => handleChange(index, e.target.value), placeholder: placeholder, className: styles$k.input }) }), jsx(Button, { variant: "ghost", size: "small", onClick: () => handleRemove(index), children: "Remove" })] }, `item-${index}`))), jsxs(Button, { variant: "primary", size: "small", onClick: handleAdd, children: ["Add ", label] })] }));
|
|
255
|
-
}
|
|
256
|
-
// Complex object array implementation
|
|
257
|
-
function ComplexArrayInput({ label, values, onChange, fields, getKey }) {
|
|
258
|
-
const handleChange = (index, field, value) => {
|
|
259
|
-
const newValues = [...values];
|
|
260
|
-
newValues[index] = { ...newValues[index], [field]: value };
|
|
261
|
-
onChange(newValues);
|
|
262
|
-
};
|
|
263
|
-
const handleAdd = () => {
|
|
264
|
-
const newItem = fields.reduce((acc, field) => {
|
|
265
|
-
return { ...acc, [field.name]: '' };
|
|
266
|
-
}, {});
|
|
267
|
-
onChange([...values, newItem]);
|
|
268
|
-
};
|
|
269
|
-
const handleRemove = (index) => {
|
|
270
|
-
const newValues = values.filter((_, i) => i !== index);
|
|
271
|
-
onChange(newValues);
|
|
272
|
-
};
|
|
273
|
-
const generateKey = (item, index) => {
|
|
274
|
-
if (getKey)
|
|
275
|
-
return getKey(item, index);
|
|
276
|
-
// Generate key from all field values
|
|
277
|
-
return fields.map(f => item[f.name] || '').join('-') + `-${index}`;
|
|
278
|
-
};
|
|
279
|
-
return (jsxs("div", { className: styles$k.arrayInput, children: [jsx("h3", { className: styles$k.arrayInputLabel, children: label }), values.map((value, index) => (jsxs("div", { className: `${styles$k.arrayInputItem} ${fields.length > 1 ? styles$k.complexItem : ''}`, children: [jsx("div", { className: styles$k.fieldsWrapper, children: fields.map((field) => (jsx(TextInput, { value: value[field.name] || '', onChange: (newValue) => handleChange(index, field.name, newValue), label: field.label, type: field.type, placeholder: field.placeholder }, field.name))) }), jsx(Button, { variant: "ghost", size: "small", onClick: () => handleRemove(index), children: "Remove" })] }, generateKey(value, index)))), jsxs(Button, { variant: "primary", size: "small", onClick: handleAdd, children: ["Add ", label] })] }));
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
var styles$j = {"checkboxLabel":"Checkbox-module_checkboxLabel__4tBVg","checkbox":"Checkbox-module_checkbox__BbJul","checkboxText":"Checkbox-module_checkboxText__oJsc9"};
|
|
172
|
+
var styles$m = {"checkboxLabel":"Checkbox-module_checkboxLabel__4tBVg","checkbox":"Checkbox-module_checkbox__BbJul","checkboxText":"Checkbox-module_checkboxText__oJsc9"};
|
|
283
173
|
|
|
284
174
|
/**
|
|
285
175
|
* Checkbox component - Modern interactive checkbox with animations
|
|
@@ -323,7 +213,7 @@ const Checkbox = ({ checked, onChange, label, disabled = false, indeterminate =
|
|
|
323
213
|
checkboxRef.current.indeterminate = indeterminate;
|
|
324
214
|
}
|
|
325
215
|
}, [indeterminate]);
|
|
326
|
-
return (jsxs("label", { className: styles$
|
|
216
|
+
return (jsxs("label", { className: styles$m.checkboxLabel, children: [jsx("input", { ref: checkboxRef, type: "checkbox", checked: checked, onChange: (e) => onChange(e.target.checked), className: styles$m.checkbox, disabled: disabled, id: id, name: name, value: value, "aria-checked": indeterminate ? 'mixed' : checked }), label && jsx("span", { className: styles$m.checkboxText, children: label })] }));
|
|
327
217
|
};
|
|
328
218
|
|
|
329
219
|
var DefaultContext = {
|
|
@@ -446,7 +336,7 @@ const parseEuropeanDate = (dateString) => {
|
|
|
446
336
|
return '';
|
|
447
337
|
};
|
|
448
338
|
|
|
449
|
-
var styles$
|
|
339
|
+
var styles$l = {"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"};
|
|
450
340
|
|
|
451
341
|
/**
|
|
452
342
|
* DateInput component - European format date picker with manual input support
|
|
@@ -533,19 +423,19 @@ function DateInput({ label, value, onChange, placeholder = "25/12/2024", onFocus
|
|
|
533
423
|
}
|
|
534
424
|
};
|
|
535
425
|
const getClassName = () => {
|
|
536
|
-
const classes = [styles$
|
|
426
|
+
const classes = [styles$l.dateInput];
|
|
537
427
|
if (error)
|
|
538
|
-
classes.push(styles$
|
|
428
|
+
classes.push(styles$l.error);
|
|
539
429
|
if (success)
|
|
540
|
-
classes.push(styles$
|
|
430
|
+
classes.push(styles$l.success);
|
|
541
431
|
if (loading)
|
|
542
|
-
classes.push(styles$
|
|
432
|
+
classes.push(styles$l.loading);
|
|
543
433
|
return classes.join(' ');
|
|
544
434
|
};
|
|
545
|
-
return (jsxs("div", { className: getClassName(), children: [jsx("label", { className: styles$
|
|
435
|
+
return (jsxs("div", { className: getClassName(), children: [jsx("label", { className: styles$l.label, children: label }), jsxs("div", { className: styles$l.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$l.textInput, disabled: disabled || loading }), jsx("button", { type: "button", onClick: handleCalendarClick, className: styles$l.calendarButton, title: "Select date from calendar", disabled: disabled || loading, children: jsx(FiCalendar, {}) }), jsx("input", { ref: hiddenDateInputRef, type: "date", onChange: handleCalendarChange, className: styles$l.hiddenDateInput, tabIndex: -1, disabled: disabled || loading })] })] }));
|
|
546
436
|
}
|
|
547
437
|
|
|
548
|
-
var styles$
|
|
438
|
+
var styles$k = {"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"};
|
|
549
439
|
|
|
550
440
|
/**
|
|
551
441
|
* SearchableDropdown component - Modern filterable dropdown with animations
|
|
@@ -650,23 +540,23 @@ function SearchableDropdown({ label, value, onChange, options, placeholder = "Se
|
|
|
650
540
|
}
|
|
651
541
|
};
|
|
652
542
|
const getTriggerClassName = () => {
|
|
653
|
-
const classes = [styles$
|
|
543
|
+
const classes = [styles$k.dropdownTrigger];
|
|
654
544
|
if (isOpen)
|
|
655
|
-
classes.push(styles$
|
|
545
|
+
classes.push(styles$k.open);
|
|
656
546
|
if (loading)
|
|
657
|
-
classes.push(styles$
|
|
547
|
+
classes.push(styles$k.loading);
|
|
658
548
|
if (error)
|
|
659
|
-
classes.push(styles$
|
|
549
|
+
classes.push(styles$k.error);
|
|
660
550
|
return classes.join(' ');
|
|
661
551
|
};
|
|
662
|
-
return (jsxs("div", { className: styles$
|
|
552
|
+
return (jsxs("div", { className: styles$k.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$k.dropdownValue} ${!displayValue ? styles$k.placeholder : ''}`, children: displayValue || placeholder }), jsx(FiChevronDown, { className: styles$k.dropdownArrow })] }), jsx(AnimatePresence, { children: isOpen && (jsxs(motion.div, { className: styles$k.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$k.dropdownSearch, children: [jsx(FiSearch, { className: styles$k.searchIcon }), jsx("input", { ref: inputRef, type: "text", className: styles$k.searchInput, placeholder: "Cerca...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), onClick: (e) => e.stopPropagation() })] }), jsxs("div", { className: styles$k.dropdownOptions, children: [allOptions.map((opt, index) => {
|
|
663
553
|
const isSelected = value === opt.value;
|
|
664
554
|
const isHighlighted = highlightedIndex === index;
|
|
665
|
-
return (jsxs(motion.button, { type: "button", className: `${styles$
|
|
666
|
-
}), allOptions.length === 0 && (jsx(motion.div, { className: styles$
|
|
555
|
+
return (jsxs(motion.button, { type: "button", className: `${styles$k.dropdownOption} ${isSelected ? styles$k.selected : ''} ${isHighlighted ? styles$k.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$k.checkIcon })] }, `${opt.value}-${index}`));
|
|
556
|
+
}), allOptions.length === 0 && (jsx(motion.div, { className: styles$k.dropdownNoResults, initial: { opacity: 0 }, animate: { opacity: 1 }, children: "No results found" }))] })] })) })] }));
|
|
667
557
|
}
|
|
668
558
|
|
|
669
|
-
var styles$
|
|
559
|
+
var styles$j = {"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"};
|
|
670
560
|
|
|
671
561
|
/**
|
|
672
562
|
* SelectInput component - Styled dropdown selector with flexible option format
|
|
@@ -703,23 +593,23 @@ var styles$g = {"selectInput":"SelectInput-module_selectInput__s6zEg","selectWra
|
|
|
703
593
|
*/
|
|
704
594
|
function SelectInput({ label, value, onChange, options, placeholder = "Select...", disabled = false, error = false, success = false, loading = false, required = false }) {
|
|
705
595
|
const getClassName = () => {
|
|
706
|
-
const classes = [styles$
|
|
596
|
+
const classes = [styles$j.selectInput];
|
|
707
597
|
if (error)
|
|
708
|
-
classes.push(styles$
|
|
598
|
+
classes.push(styles$j.error);
|
|
709
599
|
if (success)
|
|
710
|
-
classes.push(styles$
|
|
600
|
+
classes.push(styles$j.success);
|
|
711
601
|
if (loading)
|
|
712
|
-
classes.push(styles$
|
|
602
|
+
classes.push(styles$j.loading);
|
|
713
603
|
return classes.join(' ');
|
|
714
604
|
};
|
|
715
|
-
return (jsxs("div", { className: getClassName(), children: [jsxs("label", { children: [label, required && jsx("span", { style: { color: 'var(--color-error)' }, children: " *" })] }), jsxs("div", { className: styles$
|
|
605
|
+
return (jsxs("div", { className: getClassName(), children: [jsxs("label", { children: [label, required && jsx("span", { style: { color: 'var(--color-error)' }, children: " *" })] }), jsxs("div", { className: styles$j.selectWrapper, children: [jsxs("select", { value: value, onChange: e => onChange(e.target.value), disabled: disabled || loading, required: required, children: [jsx("option", { value: "", children: placeholder }), options.map(opt => {
|
|
716
606
|
const optionValue = typeof opt === 'string' ? opt : opt.value;
|
|
717
607
|
const optionLabel = typeof opt === 'string' ? opt : opt.label;
|
|
718
608
|
return (jsx("option", { value: optionValue, children: optionLabel }, optionValue));
|
|
719
|
-
})] }), jsx(FiChevronDown, { className: styles$
|
|
609
|
+
})] }), jsx(FiChevronDown, { className: styles$j.selectIcon })] })] }));
|
|
720
610
|
}
|
|
721
611
|
|
|
722
|
-
var styles$
|
|
612
|
+
var styles$i = {"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-"};
|
|
723
613
|
|
|
724
614
|
/**
|
|
725
615
|
* TextArea component - Multi-line text input with character counting
|
|
@@ -751,37 +641,88 @@ var styles$f = {"textareaContainer":"TextArea-module_textareaContainer__AquFj","
|
|
|
751
641
|
* required
|
|
752
642
|
* />
|
|
753
643
|
*/
|
|
754
|
-
function TextArea({ label, value, onChange, rows = 5, placeholder = "", required = false, maxLength, disabled = false, error = false, success = false, loading = false, focusMode = false }) {
|
|
644
|
+
function TextArea({ label, value, onChange, rows = 5, placeholder = "", required = false, maxLength, disabled = false, error = false, success = false, loading = false, focusMode = false, compact = false }) {
|
|
755
645
|
const textareaId = `textarea-${Math.random().toString(36).substr(2, 9)}`;
|
|
756
646
|
const getContainerClassName = () => {
|
|
757
|
-
const classes = [styles$
|
|
647
|
+
const classes = [styles$i.textareaContainer];
|
|
758
648
|
if (error)
|
|
759
|
-
classes.push(styles$
|
|
649
|
+
classes.push(styles$i.error);
|
|
760
650
|
if (success)
|
|
761
|
-
classes.push(styles$
|
|
651
|
+
classes.push(styles$i.success);
|
|
762
652
|
if (loading)
|
|
763
|
-
classes.push(styles$
|
|
653
|
+
classes.push(styles$i.loading);
|
|
764
654
|
if (focusMode)
|
|
765
|
-
classes.push(styles$
|
|
655
|
+
classes.push(styles$i.focusMode);
|
|
656
|
+
if (compact)
|
|
657
|
+
classes.push(styles$i.compact);
|
|
766
658
|
return classes.join(' ');
|
|
767
659
|
};
|
|
768
660
|
const getCharCountClassName = () => {
|
|
769
661
|
if (!maxLength)
|
|
770
|
-
return styles$
|
|
771
|
-
const classes = [styles$
|
|
662
|
+
return styles$i.characterCount;
|
|
663
|
+
const classes = [styles$i.characterCount];
|
|
772
664
|
const percentage = (value.length / maxLength) * 100;
|
|
773
665
|
if (percentage >= 100) {
|
|
774
|
-
classes.push(styles$
|
|
666
|
+
classes.push(styles$i.atLimit);
|
|
775
667
|
}
|
|
776
668
|
else if (percentage >= 80) {
|
|
777
|
-
classes.push(styles$
|
|
669
|
+
classes.push(styles$i.nearLimit);
|
|
778
670
|
}
|
|
779
671
|
return classes.join(' ');
|
|
780
672
|
};
|
|
781
|
-
return (jsxs("div", { className: getContainerClassName(), children: [jsxs("label", { htmlFor: textareaId, className: styles$
|
|
673
|
+
return (jsxs("div", { className: getContainerClassName(), children: [label && (jsxs("label", { htmlFor: textareaId, className: styles$i.textareaLabel, children: [label, required && jsx("span", { className: styles$i.requiredIndicator, children: "*" })] })), jsx("textarea", { id: textareaId, value: value, onChange: (e) => onChange(e.target.value), rows: rows, placeholder: placeholder, maxLength: maxLength, className: styles$i.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 })] }))] }));
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
var styles$h = {"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"};
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* TextInput component - A versatile text input field with label and error handling
|
|
680
|
+
*
|
|
681
|
+
* @component
|
|
682
|
+
* @description
|
|
683
|
+
* A foundational input component that provides a clean, accessible text field with
|
|
684
|
+
* built-in support for labels, validation errors, and various HTML5 input types.
|
|
685
|
+
* Follows design system tokens for consistent theming across light/dark modes.
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* // Basic usage
|
|
689
|
+
* <TextInput
|
|
690
|
+
* label="Email Address"
|
|
691
|
+
* value={email}
|
|
692
|
+
* onChange={setEmail}
|
|
693
|
+
* type="email"
|
|
694
|
+
* placeholder="Enter your email"
|
|
695
|
+
* />
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* // With validation error
|
|
699
|
+
* <TextInput
|
|
700
|
+
* label="Password"
|
|
701
|
+
* value={password}
|
|
702
|
+
* onChange={setPassword}
|
|
703
|
+
* type="password"
|
|
704
|
+
* error="Password must be at least 8 characters"
|
|
705
|
+
* required
|
|
706
|
+
* />
|
|
707
|
+
*/
|
|
708
|
+
function TextInput({ label, value, onChange, type = "text", onFocus, onBlur, placeholder, error, required, disabled = false, success = false, loading = false, icon, actionButton, maxLength, autoComplete }) {
|
|
709
|
+
const inputId = `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
710
|
+
const getContainerClassName = () => {
|
|
711
|
+
const classes = [styles$h.textInput];
|
|
712
|
+
if (success)
|
|
713
|
+
classes.push(styles$h.success);
|
|
714
|
+
if (loading)
|
|
715
|
+
classes.push(styles$h.loading);
|
|
716
|
+
if (icon)
|
|
717
|
+
classes.push(styles$h.withIcon);
|
|
718
|
+
if (actionButton)
|
|
719
|
+
classes.push(styles$h.withAction);
|
|
720
|
+
return classes.join(' ');
|
|
721
|
+
};
|
|
722
|
+
return (jsxs("div", { className: getContainerClassName(), children: [jsxs("label", { htmlFor: inputId, children: [label, required && jsx("span", { className: styles$h.required, children: "*" })] }), jsxs("div", { style: { position: 'relative' }, children: [icon && jsx("div", { className: styles$h.inputIcon, children: icon }), jsx("input", { id: inputId, type: type, value: value, onChange: (e) => onChange(e.target.value), onFocus: onFocus, onBlur: onBlur, placeholder: placeholder, className: error ? styles$h.inputError : '', "aria-invalid": !!error, "aria-describedby": error ? `${inputId}-error` : undefined, disabled: disabled || loading, maxLength: maxLength, autoComplete: autoComplete }), actionButton && (jsx("button", { type: "button", className: styles$h.actionButton, onClick: actionButton.onClick, disabled: disabled || loading, children: actionButton.label }))] }), error && (jsx("span", { id: `${inputId}-error`, className: styles$h.errorMessage, children: error }))] }));
|
|
782
723
|
}
|
|
783
724
|
|
|
784
|
-
var styles$
|
|
725
|
+
var styles$g = {"toggleContainer":"Toggle-module_toggleContainer__QxqQb","toggleButton":"Toggle-module_toggleButton__WUUf-","active":"Toggle-module_active__fX6Io"};
|
|
785
726
|
|
|
786
727
|
/**
|
|
787
728
|
* Toggle Component
|
|
@@ -825,11 +766,18 @@ var styles$e = {"toggleContainer":"Toggle-module_toggleContainer__QxqQb","toggle
|
|
|
825
766
|
* @returns {JSX.Element} The rendered Toggle component
|
|
826
767
|
*/
|
|
827
768
|
function Toggle(props) {
|
|
828
|
-
const { isOn, onToggle, leftLabel, rightLabel, leftIcon, rightIcon } = props;
|
|
829
|
-
|
|
769
|
+
const { isOn, onToggle, leftLabel, rightLabel, leftIcon, rightIcon, className, style } = props;
|
|
770
|
+
// Ensure content stays centered by merging styles
|
|
771
|
+
const buttonStyle = {
|
|
772
|
+
display: 'flex',
|
|
773
|
+
alignItems: 'center',
|
|
774
|
+
justifyContent: 'center',
|
|
775
|
+
...style
|
|
776
|
+
};
|
|
777
|
+
return (jsxs("div", { className: `${styles$g.toggleContainer} ${className || ''}`, children: [jsxs("button", { className: `${styles$g.toggleButton} ${!isOn ? styles$g.active : ''}`, onClick: () => onToggle(false), style: buttonStyle, children: [leftIcon, leftLabel] }), jsxs("button", { className: `${styles$g.toggleButton} ${isOn ? styles$g.active : ''}`, onClick: () => onToggle(true), style: buttonStyle, children: [rightIcon, rightLabel] })] }));
|
|
830
778
|
}
|
|
831
779
|
|
|
832
|
-
var styles$
|
|
780
|
+
var styles$f = {"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-","pulse":"NumberStepper-module_pulse__51oUo"};
|
|
833
781
|
|
|
834
782
|
/**
|
|
835
783
|
* NumberStepper Component
|
|
@@ -946,18 +894,18 @@ const NumberStepper = ({ value, onChange, min = -Infinity, max = Infinity, step
|
|
|
946
894
|
setDisplayValue(finalValue);
|
|
947
895
|
}, [displayValue, min, max, step, onChange]);
|
|
948
896
|
const containerClasses = [
|
|
949
|
-
styles$
|
|
950
|
-
styles$
|
|
951
|
-
styles$
|
|
952
|
-
disabled && styles$
|
|
897
|
+
styles$f.container,
|
|
898
|
+
styles$f[size],
|
|
899
|
+
styles$f[variant],
|
|
900
|
+
disabled && styles$f.disabled,
|
|
953
901
|
className
|
|
954
902
|
].filter(Boolean).join(' ');
|
|
955
903
|
const isDecrementDisabled = disabled || value <= min;
|
|
956
904
|
const isIncrementDisabled = disabled || value >= max;
|
|
957
|
-
return (jsxs("div", { className: containerClasses, children: [(label || icon) && (jsxs("div", { className: styles$
|
|
905
|
+
return (jsxs("div", { className: containerClasses, children: [(label || icon) && (jsxs("div", { className: styles$f.header, children: [icon && jsx("span", { className: styles$f.icon, children: icon }), label && jsx("label", { className: styles$f.label, children: label })] })), jsxs("div", { className: styles$f.stepper, onKeyDown: handleKeyDown, tabIndex: disabled ? -1 : 0, children: [jsx(motion.button, { className: styles$f.button, 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: showPlusMinus ? (jsx("span", { className: styles$f.buttonIcon, children: "\u2212" })) : (jsx("svg", { className: styles$f.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$f.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$f.valueWrapper, children: jsx("input", { type: "text", className: styles$f.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$f.button, 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: showPlusMinus ? (jsx("span", { className: styles$f.buttonIcon, children: "+" })) : (jsx("svg", { className: styles$f.buttonIcon, viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M9 18L15 12L9 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })) })] }), (min !== -Infinity || max !== Infinity) && (jsxs("div", { className: styles$f.limits, children: [jsx("span", { className: styles$f.limit, children: min !== -Infinity && `Min: ${min}` }), jsx("span", { className: styles$f.limit, children: max !== Infinity && `Max: ${max}` })] }))] }));
|
|
958
906
|
};
|
|
959
907
|
|
|
960
|
-
var styles$
|
|
908
|
+
var styles$e = {"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"};
|
|
961
909
|
|
|
962
910
|
/**
|
|
963
911
|
* ToggleButton Component
|
|
@@ -995,18 +943,18 @@ var styles$c = {"button":"ToggleButton-module_button__DTuyY","background":"Toggl
|
|
|
995
943
|
*/
|
|
996
944
|
const ToggleButton = ({ active, onClick, icon, label, disabled = false, size = 'medium', variant = 'default', activeColor = 'primary', showCheckmark = false, animation = 'scale', className = '', tooltip, hideLabelOnMobile = false, }) => {
|
|
997
945
|
const buttonClasses = [
|
|
998
|
-
styles$
|
|
999
|
-
styles$
|
|
1000
|
-
styles$
|
|
1001
|
-
active && styles$
|
|
1002
|
-
active && styles$
|
|
1003
|
-
disabled && styles$
|
|
1004
|
-
animation !== 'none' && styles$
|
|
946
|
+
styles$e.button,
|
|
947
|
+
styles$e[size],
|
|
948
|
+
styles$e[variant],
|
|
949
|
+
active && styles$e.active,
|
|
950
|
+
active && styles$e[`active-${activeColor}`],
|
|
951
|
+
disabled && styles$e.disabled,
|
|
952
|
+
animation !== 'none' && styles$e[`animation-${animation}`],
|
|
1005
953
|
className
|
|
1006
954
|
].filter(Boolean).join(' ');
|
|
1007
955
|
const labelClasses = [
|
|
1008
|
-
styles$
|
|
1009
|
-
hideLabelOnMobile && styles$
|
|
956
|
+
styles$e.label,
|
|
957
|
+
hideLabelOnMobile && styles$e.hideMobile
|
|
1010
958
|
].filter(Boolean).join(' ');
|
|
1011
959
|
const iconVariants = {
|
|
1012
960
|
scale: {
|
|
@@ -1058,10 +1006,99 @@ const ToggleButton = ({ active, onClick, icon, label, disabled = false, size = '
|
|
|
1058
1006
|
}
|
|
1059
1007
|
}
|
|
1060
1008
|
};
|
|
1061
|
-
return (jsxs(motion.button, { className: buttonClasses, onClick: onClick, disabled: disabled, whileHover: !disabled ? { scale: 1.05 } : undefined, whileTap: !disabled ? { scale: 0.95 } : undefined, title: tooltip, "aria-pressed": active, "aria-label": label, children: [jsx(motion.div, { className: styles$
|
|
1009
|
+
return (jsxs(motion.button, { className: buttonClasses, onClick: onClick, disabled: disabled, whileHover: !disabled ? { scale: 1.05 } : undefined, whileTap: !disabled ? { scale: 0.95 } : undefined, title: tooltip, "aria-pressed": active, "aria-label": label, children: [jsx(motion.div, { className: styles$e.background, variants: backgroundVariants, initial: "inactive", animate: active ? "active" : "inactive" }), jsxs("div", { className: styles$e.content, children: [icon && (jsx(motion.div, { className: styles$e.iconWrapper, variants: iconVariants[animation], initial: "inactive", animate: active ? "active" : "inactive", transition: { duration: 0.3 }, children: typeof icon === 'string' ? (jsx("span", { className: styles$e.icon, children: icon })) : (jsx("div", { className: styles$e.icon, children: icon })) })), label && jsx("span", { className: labelClasses, children: label }), jsx(AnimatePresence, { children: showCheckmark && active && (jsx(motion.div, { className: styles$e.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$e.ripple, initial: { scale: 0, opacity: 0.5 }, animate: { scale: 2, opacity: 0 }, exit: { scale: 0, opacity: 0 }, transition: { duration: 0.6 } })) })] }));
|
|
1062
1010
|
};
|
|
1063
1011
|
|
|
1064
|
-
var styles$
|
|
1012
|
+
var styles$d = {"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"};
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* ArrayInput component - Versatile dynamic list manager
|
|
1016
|
+
*
|
|
1017
|
+
* @component
|
|
1018
|
+
* @description
|
|
1019
|
+
* A flexible component that can handle both simple string arrays and complex object arrays.
|
|
1020
|
+
* Users can add, remove, and edit items dynamically. Supports custom field configurations
|
|
1021
|
+
* for complex data structures.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* // Simple string array
|
|
1025
|
+
* <ArrayInput
|
|
1026
|
+
* label="Tags"
|
|
1027
|
+
* values={tags}
|
|
1028
|
+
* onChange={setTags}
|
|
1029
|
+
* placeholder="Enter tag"
|
|
1030
|
+
* />
|
|
1031
|
+
*
|
|
1032
|
+
* @example
|
|
1033
|
+
* // Complex object array
|
|
1034
|
+
* <ArrayInput
|
|
1035
|
+
* type="complex"
|
|
1036
|
+
* label="Social Links"
|
|
1037
|
+
* values={links}
|
|
1038
|
+
* onChange={setLinks}
|
|
1039
|
+
* fields={[
|
|
1040
|
+
* { name: 'label', label: 'Label', placeholder: 'GitHub' },
|
|
1041
|
+
* { name: 'url', label: 'URL', type: 'url', placeholder: 'https://github.com/...' }
|
|
1042
|
+
* ]}
|
|
1043
|
+
* />
|
|
1044
|
+
*/
|
|
1045
|
+
function ArrayInput(props) {
|
|
1046
|
+
if (props.type === 'complex') {
|
|
1047
|
+
return jsx(ComplexArrayInput, { ...props });
|
|
1048
|
+
}
|
|
1049
|
+
return jsx(SimpleArrayInput, { ...props });
|
|
1050
|
+
}
|
|
1051
|
+
// Simple string array implementation
|
|
1052
|
+
function SimpleArrayInput({ label, values, onChange, placeholder, itemStyle, inputStyle, multiline = false, rows = 3 }) {
|
|
1053
|
+
const handleChange = (index, value) => {
|
|
1054
|
+
const newValues = [...values];
|
|
1055
|
+
newValues[index] = value;
|
|
1056
|
+
onChange(newValues);
|
|
1057
|
+
};
|
|
1058
|
+
const handleAdd = () => {
|
|
1059
|
+
onChange([...values, '']);
|
|
1060
|
+
};
|
|
1061
|
+
const handleRemove = (index) => {
|
|
1062
|
+
const newValues = values.filter((_, i) => i !== index);
|
|
1063
|
+
onChange(newValues);
|
|
1064
|
+
};
|
|
1065
|
+
return (jsxs("div", { className: styles$d.arrayInput, children: [jsx("h3", { className: styles$d.arrayInputLabel, children: label }), jsx("div", { children: jsx(AnimatePresence, { children: values.map((value, index) => (jsxs(motion.div, { className: styles$d.arrayInputItem, style: itemStyle, initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0 }, transition: {
|
|
1066
|
+
duration: 0.3,
|
|
1067
|
+
ease: "easeInOut",
|
|
1068
|
+
layout: { duration: 0.2 }
|
|
1069
|
+
}, children: [jsx("div", { className: styles$d.inputWrapper, children: multiline ? (jsx("div", { style: inputStyle, children: jsx(TextArea, { label: "", value: value, onChange: (newValue) => handleChange(index, newValue), placeholder: placeholder, rows: rows, compact: true }) })) : (jsx("input", { type: "text", value: value, onChange: (e) => handleChange(index, e.target.value), placeholder: placeholder, className: styles$d.input, style: inputStyle })) }), jsx(Button, { variant: "ghost", size: "small", onClick: () => handleRemove(index), "aria-label": "Remove item", className: styles$d.removeButton, children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) })] }, `item-${index}`))) }) }), jsxs(Button, { variant: "primary", size: "small", onClick: handleAdd, className: styles$d.addButton, children: ["Add ", label] })] }));
|
|
1070
|
+
}
|
|
1071
|
+
// Complex object array implementation
|
|
1072
|
+
function ComplexArrayInput({ label, values, onChange, fields, getKey, itemStyle, inputStyle }) {
|
|
1073
|
+
const handleChange = (index, field, value) => {
|
|
1074
|
+
const newValues = [...values];
|
|
1075
|
+
newValues[index] = { ...newValues[index], [field]: value };
|
|
1076
|
+
onChange(newValues);
|
|
1077
|
+
};
|
|
1078
|
+
const handleAdd = () => {
|
|
1079
|
+
const newItem = fields.reduce((acc, field) => {
|
|
1080
|
+
return { ...acc, [field.name]: '' };
|
|
1081
|
+
}, {});
|
|
1082
|
+
onChange([...values, newItem]);
|
|
1083
|
+
};
|
|
1084
|
+
const handleRemove = (index) => {
|
|
1085
|
+
const newValues = values.filter((_, i) => i !== index);
|
|
1086
|
+
onChange(newValues);
|
|
1087
|
+
};
|
|
1088
|
+
const generateKey = (item, index) => {
|
|
1089
|
+
if (getKey)
|
|
1090
|
+
return getKey(item, index);
|
|
1091
|
+
// Generate key from all field values
|
|
1092
|
+
return fields.map(f => item[f.name] || '').join('-') + `-${index}`;
|
|
1093
|
+
};
|
|
1094
|
+
return (jsxs("div", { className: styles$d.arrayInput, children: [jsx("h3", { className: styles$d.arrayInputLabel, children: label }), jsx("div", { children: jsx(AnimatePresence, { children: values.map((value, index) => (jsxs(motion.div, { className: `${styles$d.arrayInputItem} ${fields.length > 1 ? styles$d.complexItem : ''}`, style: itemStyle, initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0 }, transition: {
|
|
1095
|
+
duration: 0.3,
|
|
1096
|
+
ease: "easeInOut",
|
|
1097
|
+
layout: { duration: 0.2 }
|
|
1098
|
+
}, children: [jsx("div", { className: styles$d.fieldsWrapper, children: fields.map((field) => (jsx("div", { style: inputStyle, children: field.multiline ? (jsx(TextArea, { value: value[field.name] || '', onChange: (newValue) => handleChange(index, field.name, newValue), label: field.label, placeholder: field.placeholder, rows: field.rows, compact: true })) : (jsx(TextInput, { value: value[field.name] || '', onChange: (newValue) => handleChange(index, field.name, newValue), label: field.label, type: field.type, placeholder: field.placeholder })) }, field.name))) }), jsx(Button, { variant: "ghost", size: "small", onClick: () => handleRemove(index), "aria-label": "Remove item", className: styles$d.removeButton, children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) }) })] }, generateKey(value, index)))) }) }), jsxs(Button, { variant: "primary", size: "small", onClick: handleAdd, className: styles$d.addButton, children: ["Add ", label] })] }));
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
var styles$c = {"fab":"EditFAB-module_fab__nSrTJ","primary":"EditFAB-module_primary__zbA9n","secondary":"EditFAB-module_secondary__BnXs0","success":"EditFAB-module_success__kcLg3","loader":"EditFAB-module_loader__TaJOm","draggable":"EditFAB-module_draggable__eE2vE","dragging":"EditFAB-module_dragging__btRJe"};
|
|
1065
1102
|
|
|
1066
1103
|
const EditFAB = ({ canEdit, isEditMode, hasUnsavedChanges = false, isSaving = false, onEnterEditMode, onExitEditMode, position = { bottom: 32, right: 32 } }) => {
|
|
1067
1104
|
const [isMobile, setIsMobile] = useState(false);
|
|
@@ -1146,15 +1183,15 @@ const EditFAB = ({ canEdit, isEditMode, hasUnsavedChanges = false, isSaving = fa
|
|
|
1146
1183
|
};
|
|
1147
1184
|
const getVariantClass = () => {
|
|
1148
1185
|
if (isSaving)
|
|
1149
|
-
return styles$
|
|
1186
|
+
return styles$c.primary;
|
|
1150
1187
|
if (isEditMode) {
|
|
1151
|
-
return hasUnsavedChanges ? styles$
|
|
1188
|
+
return hasUnsavedChanges ? styles$c.success : styles$c.secondary;
|
|
1152
1189
|
}
|
|
1153
|
-
return styles$
|
|
1190
|
+
return styles$c.primary;
|
|
1154
1191
|
};
|
|
1155
1192
|
const getIcon = () => {
|
|
1156
1193
|
if (isSaving) {
|
|
1157
|
-
return jsx("div", { className: styles$
|
|
1194
|
+
return jsx("div", { className: styles$c.loader });
|
|
1158
1195
|
}
|
|
1159
1196
|
if (isEditMode) {
|
|
1160
1197
|
return hasUnsavedChanges ? jsx(Check, { size: 24 }) : jsx(X, { size: 24 });
|
|
@@ -1169,14 +1206,14 @@ const EditFAB = ({ canEdit, isEditMode, hasUnsavedChanges = false, isSaving = fa
|
|
|
1169
1206
|
}
|
|
1170
1207
|
return "Enter edit mode";
|
|
1171
1208
|
};
|
|
1172
|
-
return (jsx(motion.button, { ref: fabRef, className: `${styles$
|
|
1209
|
+
return (jsx(motion.button, { ref: fabRef, className: `${styles$c.fab} ${getVariantClass()} ${isMobile ? styles$c.draggable : ''} ${isDragging ? styles$c.dragging : ''}`, style: getPositionStyles(), onClick: handleClick, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, disabled: isSaving, "aria-label": getAriaLabel(), initial: { scale: 0, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0, opacity: 0 }, whileHover: !isSaving && !isDragging ? { scale: 1.1 } : {}, whileTap: !isSaving && !isDragging ? { scale: 0.9 } : {}, transition: {
|
|
1173
1210
|
type: "spring",
|
|
1174
1211
|
stiffness: 260,
|
|
1175
1212
|
damping: 20
|
|
1176
1213
|
}, children: getIcon() }));
|
|
1177
1214
|
};
|
|
1178
1215
|
|
|
1179
|
-
var styles$
|
|
1216
|
+
var styles$b = {"searchContainer":"SearchBar-module_searchContainer__TdM1w","searchInputWrapper":"SearchBar-module_searchInputWrapper__kCZLU","searchIcon":"SearchBar-module_searchIcon__IIxEu","searchInput":"SearchBar-module_searchInput__V4gkE","clearButton":"SearchBar-module_clearButton__7fNIY","filterSelect":"SearchBar-module_filterSelect__xIVE4","resultsDropdown":"SearchBar-module_resultsDropdown__yh6NF","loadingState":"SearchBar-module_loadingState__4gidK","emptyState":"SearchBar-module_emptyState__RbI4s","spinner":"SearchBar-module_spinner__PMc6-","resultsGroups":"SearchBar-module_resultsGroups__U24DC","resultGroup":"SearchBar-module_resultGroup__SoTQH","groupHeader":"SearchBar-module_groupHeader__bFRHA","groupIcon":"SearchBar-module_groupIcon__9ENM-","groupTitle":"SearchBar-module_groupTitle__ZekZs","groupCount":"SearchBar-module_groupCount__PQIqw","groupResults":"SearchBar-module_groupResults__xTF52","resultItem":"SearchBar-module_resultItem__VaKKy","highlighted":"SearchBar-module_highlighted__Q-3sH","resultTitle":"SearchBar-module_resultTitle__i1uqL","resultSubtitle":"SearchBar-module_resultSubtitle__LQOJ1","resultMeta":"SearchBar-module_resultMeta__Kmkrn","resultContent":"SearchBar-module_resultContent__TzVzL","highlight":"SearchBar-module_highlight__Q3PSP"};
|
|
1180
1217
|
|
|
1181
1218
|
// Default filter options for backwards compatibility
|
|
1182
1219
|
const defaultFilterOptions = [
|
|
@@ -1369,18 +1406,18 @@ const SearchBar = ({ className, placeholder = "Search (Ctrl+Space)...", onSearch
|
|
|
1369
1406
|
return text || '';
|
|
1370
1407
|
const regex = new RegExp(`(${highlight.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, 'gi');
|
|
1371
1408
|
const parts = text.split(regex);
|
|
1372
|
-
return parts.map((part, index) => regex.test(part) ? (jsx("mark", { className: styles$
|
|
1409
|
+
return parts.map((part, index) => regex.test(part) ? (jsx("mark", { className: styles$b.highlight, children: part }, index)) : (part));
|
|
1373
1410
|
};
|
|
1374
|
-
return (jsxs("div", { ref: searchRef, className: `${styles$
|
|
1411
|
+
return (jsxs("div", { ref: searchRef, className: `${styles$b.searchContainer} ${className || ''}`, children: [jsxs("div", { className: styles$b.searchInputWrapper, children: [jsx(FiSearch, { className: styles$b.searchIcon }), jsx("input", { ref: inputRef, type: "text", value: query, onChange: (e) => setQuery(e.target.value), onKeyDown: handleKeyDown, onFocus: () => query.trim() && results.length > 0 && setIsDropdownOpen(true), placeholder: placeholder, className: styles$b.searchInput, "aria-label": "Search", "aria-expanded": isDropdownOpen, "aria-controls": "search-results", "aria-autocomplete": "list" }), query && (jsx(motion.button, { className: styles$b.clearButton, onClick: handleClear, whileHover: { scale: 1.1 }, whileTap: { scale: 0.9 }, initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, children: jsx(FiX, {}) })), showFilter && (jsx("select", { value: filter, onChange: (e) => setFilter(e.target.value), className: styles$b.filterSelect, "aria-label": "Filter search results", children: filterOptions.map(option => (jsx("option", { value: option.value, children: option.label }, option.value))) }))] }), jsx(AnimatePresence, { children: isDropdownOpen && (jsx(motion.div, { ref: resultsRef, id: "search-results", className: styles$b.resultsDropdown, initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -10 }, transition: { duration: 0.2 }, children: isLoading ? (jsxs("div", { className: styles$b.loadingState, children: [jsx("div", { className: styles$b.spinner }), jsx("span", { children: "Searching..." })] })) : results.length === 0 ? (jsxs("div", { className: styles$b.emptyState, children: ["No results found for \"", query, "\""] })) : (jsx("div", { className: styles$b.resultsGroups, children: Object.entries(groupedResults).map(([type, groupResults]) => {
|
|
1375
1412
|
const Icon = entityIcons[type];
|
|
1376
|
-
return (jsxs("div", { className: styles$
|
|
1413
|
+
return (jsxs("div", { className: styles$b.resultGroup, children: [jsxs("div", { className: styles$b.groupHeader, children: [Icon && jsx(Icon, { className: styles$b.groupIcon }), jsx("span", { className: styles$b.groupTitle, children: type.charAt(0).toUpperCase() + type.slice(1) }), jsx("span", { className: styles$b.groupCount, children: groupResults.length })] }), jsx("div", { className: styles$b.groupResults, children: groupResults.map((result) => {
|
|
1377
1414
|
const globalIndex = results.indexOf(result);
|
|
1378
|
-
return (jsxs(motion.button, { "data-result-index": globalIndex, className: `${styles$
|
|
1415
|
+
return (jsxs(motion.button, { "data-result-index": globalIndex, className: `${styles$b.resultItem} ${highlightedIndex === globalIndex ? styles$b.highlighted : ''}`, onClick: () => handleResultClick(result), whileHover: { x: 4 }, onMouseEnter: () => setHighlightedIndex(globalIndex), children: [jsxs("div", { className: styles$b.resultContent, children: [jsx("div", { className: styles$b.resultTitle, children: highlightMatch(result.title || 'Untitled', query) }), result.subtitle && (jsx("div", { className: styles$b.resultSubtitle, children: highlightMatch(result.subtitle, query) }))] }), result.meta && (jsx("div", { className: styles$b.resultMeta, children: result.meta }))] }, `${result.type}-${result.id}`));
|
|
1379
1416
|
}) })] }, type));
|
|
1380
1417
|
}) })) })) })] }));
|
|
1381
1418
|
};
|
|
1382
1419
|
|
|
1383
|
-
var styles$
|
|
1420
|
+
var styles$a = {"modalOverlay":"TimePickerModal-module_modalOverlay__Cbq5-","modalContent":"TimePickerModal-module_modalContent__e6py2","modalHeader":"TimePickerModal-module_modalHeader__XhTgK","closeButton":"TimePickerModal-module_closeButton__qsRAG","timeDisplay":"TimePickerModal-module_timeDisplay__voGP4","pickerContainer":"TimePickerModal-module_pickerContainer__4qn3r","pickerColumn":"TimePickerModal-module_pickerColumn__0-kWf","pickerLabel":"TimePickerModal-module_pickerLabel__e7zQ2","pickerScroll":"TimePickerModal-module_pickerScroll__5Dcvw","pickerItem":"TimePickerModal-module_pickerItem__n8sC2","selected":"TimePickerModal-module_selected__oQA8Z","pickerDivider":"TimePickerModal-module_pickerDivider__eg83F","modalActions":"TimePickerModal-module_modalActions__eJRWU","cancelButton":"TimePickerModal-module_cancelButton__zri81","confirmButton":"TimePickerModal-module_confirmButton__q2p3Q"};
|
|
1384
1421
|
|
|
1385
1422
|
function TimePickerModal({ isOpen, onClose, value, onChange }) {
|
|
1386
1423
|
const [hours, minutes] = value ? value.split(':').map(Number) : [12, 0];
|
|
@@ -1401,10 +1438,10 @@ function TimePickerModal({ isOpen, onClose, value, onChange }) {
|
|
|
1401
1438
|
};
|
|
1402
1439
|
if (!isOpen)
|
|
1403
1440
|
return null;
|
|
1404
|
-
return (jsx("div", { className: styles$
|
|
1441
|
+
return (jsx("div", { className: styles$a.modalOverlay, onClick: onClose, children: jsxs("div", { className: styles$a.modalContent, onClick: (e) => e.stopPropagation(), children: [jsxs("div", { className: styles$a.modalHeader, children: [jsx("h3", { children: "Select Time" }), jsx("button", { className: styles$a.closeButton, onClick: onClose, "aria-label": "Close", children: jsx(FiX, {}) })] }), jsxs("div", { className: styles$a.timeDisplay, children: [selectedHour.toString().padStart(2, '0'), ":", selectedMinute.toString().padStart(2, '0')] }), jsxs("div", { className: styles$a.pickerContainer, children: [jsxs("div", { className: styles$a.pickerColumn, children: [jsx("div", { className: styles$a.pickerLabel, children: "Hours" }), jsx("div", { className: styles$a.pickerScroll, children: Array.from({ length: 24 }, (_, i) => (jsx("button", { className: `${styles$a.pickerItem} ${selectedHour === i ? styles$a.selected : ''}`, onClick: () => setSelectedHour(i), children: i.toString().padStart(2, '0') }, i))) })] }), jsx("div", { className: styles$a.pickerDivider, children: ":" }), jsxs("div", { className: styles$a.pickerColumn, children: [jsx("div", { className: styles$a.pickerLabel, children: "Minutes" }), jsx("div", { className: styles$a.pickerScroll, children: Array.from({ length: 60 }, (_, i) => (jsx("button", { className: `${styles$a.pickerItem} ${selectedMinute === i ? styles$a.selected : ''}`, onClick: () => setSelectedMinute(i), children: i.toString().padStart(2, '0') }, i))) })] })] }), jsxs("div", { className: styles$a.modalActions, children: [jsx("button", { className: styles$a.cancelButton, onClick: onClose, children: "Cancel" }), jsx("button", { className: styles$a.confirmButton, onClick: handleConfirm, children: "Confirm" })] })] }) }));
|
|
1405
1442
|
}
|
|
1406
1443
|
|
|
1407
|
-
var styles$
|
|
1444
|
+
var styles$9 = {"timeInput":"TimeInput-module_timeInput__h1DpT","label":"TimeInput-module_label__d4rZw","required":"TimeInput-module_required__rc1vq","inputWrapper":"TimeInput-module_inputWrapper__4RPAn","textInput":"TimeInput-module_textInput__M3eBZ","clockButton":"TimeInput-module_clockButton__3qoub","error":"TimeInput-module_error__gJnpk","success":"TimeInput-module_success__np-lF","loading":"TimeInput-module_loading__Wb1DC","disabled":"TimeInput-module_disabled__wxiZ-"};
|
|
1408
1445
|
|
|
1409
1446
|
function TimeInput({ label, value, onChange, placeholder = "14:30", onFocus, onBlur, error = false, success = false, loading = false, disabled = false, required = false }) {
|
|
1410
1447
|
const [showPicker, setShowPicker] = useState(false);
|
|
@@ -1457,18 +1494,18 @@ function TimeInput({ label, value, onChange, placeholder = "14:30", onFocus, onB
|
|
|
1457
1494
|
}
|
|
1458
1495
|
};
|
|
1459
1496
|
const getContainerClassName = () => {
|
|
1460
|
-
const classes = [styles$
|
|
1497
|
+
const classes = [styles$9.timeInput];
|
|
1461
1498
|
if (error)
|
|
1462
|
-
classes.push(styles$
|
|
1499
|
+
classes.push(styles$9.error);
|
|
1463
1500
|
if (success)
|
|
1464
|
-
classes.push(styles$
|
|
1501
|
+
classes.push(styles$9.success);
|
|
1465
1502
|
if (loading)
|
|
1466
|
-
classes.push(styles$
|
|
1503
|
+
classes.push(styles$9.loading);
|
|
1467
1504
|
if (disabled)
|
|
1468
|
-
classes.push(styles$
|
|
1505
|
+
classes.push(styles$9.disabled);
|
|
1469
1506
|
return classes.join(' ');
|
|
1470
1507
|
};
|
|
1471
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: getContainerClassName(), children: [jsxs("label", { className: styles$
|
|
1508
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: getContainerClassName(), children: [jsxs("label", { className: styles$9.label, children: [label, required && jsx("span", { className: styles$9.required, children: "*" })] }), jsxs("div", { className: styles$9.inputWrapper, children: [jsx("input", { type: "text", value: value, onChange: (e) => handleTextChange(e.target.value), onFocus: onFocus, onBlur: onBlur, placeholder: placeholder, className: styles$9.textInput, maxLength: 5, disabled: disabled || loading, "aria-invalid": error, "aria-required": required, inputMode: "numeric", pattern: "[0-9:]*" }), jsx("button", { type: "button", onClick: handleClockClick, className: styles$9.clockButton, title: "Open time picker", disabled: disabled || loading, "aria-label": "Open time picker", children: jsx(FiClock, { size: 20 }) })] })] }), jsx(TimePickerModal, { isOpen: showPicker, onClose: () => setShowPicker(false), value: value, onChange: onChange })] }));
|
|
1472
1509
|
}
|
|
1473
1510
|
|
|
1474
1511
|
const ThemeContext = createContext(undefined);
|
|
@@ -1480,7 +1517,7 @@ const useTheme = () => {
|
|
|
1480
1517
|
return context;
|
|
1481
1518
|
};
|
|
1482
1519
|
|
|
1483
|
-
var styles$
|
|
1520
|
+
var styles$8 = {"button":"ThemeSwitcher-module_button__VfRjU","iconWrapper":"ThemeSwitcher-module_iconWrapper__FpHo8","label":"ThemeSwitcher-module_label__2Hfkp","toggle":"ThemeSwitcher-module_toggle__ATXx4","toggleTrack":"ThemeSwitcher-module_toggleTrack__x28Rv","toggleThumb":"ThemeSwitcher-module_toggleThumb__V8QeN","dropdown":"ThemeSwitcher-module_dropdown__3qLdt","dropdownTrigger":"ThemeSwitcher-module_dropdownTrigger__UzYV5","dropdownMenu":"ThemeSwitcher-module_dropdownMenu__3L5hT","dropdownItem":"ThemeSwitcher-module_dropdownItem__inw-K","active":"ThemeSwitcher-module_active__OHP19","icon":"ThemeSwitcher-module_icon__iRZiJ","text":"ThemeSwitcher-module_text__OCOoA"};
|
|
1484
1521
|
|
|
1485
1522
|
const ThemeSwitcher = ({ variant = 'button', showLabel = false, className = '', currentTheme, onThemeChange, themes: customThemes, }) => {
|
|
1486
1523
|
// Try to use internal context if available, otherwise use props
|
|
@@ -1508,16 +1545,16 @@ const ThemeSwitcher = ({ variant = 'button', showLabel = false, className = '',
|
|
|
1508
1545
|
if (variant === 'toggle') {
|
|
1509
1546
|
// Simple toggle between light and dark
|
|
1510
1547
|
const isDark = theme.includes('dark');
|
|
1511
|
-
return (jsxs(motion.button, { className: `${styles$
|
|
1548
|
+
return (jsxs(motion.button, { className: `${styles$8.toggle} ${className}`, onClick: () => setTheme(isDark ? 'light' : 'dark'), whileTap: { scale: 0.95 }, "aria-label": "Toggle theme", children: [jsx(motion.div, { className: styles$8.toggleTrack, animate: { backgroundColor: isDark ? 'var(--color-primary)' : 'var(--color-border)' }, children: jsx(motion.div, { className: styles$8.toggleThumb, animate: { x: isDark ? 24 : 0 }, transition: { type: 'spring', stiffness: 500, damping: 30 }, children: isDark ? jsx(FiMoon, { size: 14 }) : jsx(FiSun, { size: 14 }) }) }), showLabel && jsx("span", { className: styles$8.label, children: isDark ? 'Dark' : 'Light' })] }));
|
|
1512
1549
|
}
|
|
1513
1550
|
if (variant === 'dropdown') {
|
|
1514
|
-
return (jsxs("div", { className: `${styles$
|
|
1551
|
+
return (jsxs("div", { className: `${styles$8.dropdown} ${className}`, children: [jsxs(motion.button, { className: styles$8.dropdownTrigger, whileTap: { scale: 0.98 }, children: [currentThemeData.icon, showLabel && jsx("span", { className: styles$8.label, children: currentThemeData.label })] }), jsx(motion.div, { className: styles$8.dropdownMenu, initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, children: themes.map((t) => (jsxs(motion.button, { className: `${styles$8.dropdownItem} ${theme === t.value ? styles$8.active : ''}`, onClick: () => setTheme(t.value), whileHover: { x: 4 }, whileTap: { scale: 0.98 }, children: [jsx("span", { className: styles$8.icon, children: t.icon }), jsx("span", { className: styles$8.text, children: t.label })] }, t.value))) })] }));
|
|
1515
1552
|
}
|
|
1516
1553
|
// Default button variant - cycles through themes
|
|
1517
|
-
return (jsxs(motion.button, { className: `${styles$
|
|
1554
|
+
return (jsxs(motion.button, { className: `${styles$8.button} ${className}`, onClick: () => {
|
|
1518
1555
|
const nextIndex = (currentThemeIndex + 1) % themes.length;
|
|
1519
1556
|
setTheme(themes[nextIndex].value);
|
|
1520
|
-
}, whileTap: { scale: 0.95 }, whileHover: { scale: 1.05 }, "aria-label": `Current theme: ${currentThemeData.label}. Click to change.`, children: [jsx(motion.div, { initial: { rotate: -180, opacity: 0 }, animate: { rotate: 0, opacity: 1 }, exit: { rotate: 180, opacity: 0 }, transition: { duration: 0.3 }, className: styles$
|
|
1557
|
+
}, whileTap: { scale: 0.95 }, whileHover: { scale: 1.05 }, "aria-label": `Current theme: ${currentThemeData.label}. Click to change.`, children: [jsx(motion.div, { initial: { rotate: -180, opacity: 0 }, animate: { rotate: 0, opacity: 1 }, exit: { rotate: 180, opacity: 0 }, transition: { duration: 0.3 }, className: styles$8.iconWrapper, children: currentThemeData.icon }, theme), showLabel && jsx("span", { className: styles$8.label, children: currentThemeData.label })] }));
|
|
1521
1558
|
};
|
|
1522
1559
|
|
|
1523
1560
|
// THIS FILE IS AUTO GENERATED
|
|
@@ -1525,7 +1562,7 @@ function SiJira (props) {
|
|
|
1525
1562
|
return GenIcon({"attr":{"role":"img","viewBox":"0 0 24 24"},"child":[{"tag":"path","attr":{"d":"M11.571 11.513H0a5.218 5.218 0 0 0 5.232 5.215h2.13v2.057A5.215 5.215 0 0 0 12.575 24V12.518a1.005 1.005 0 0 0-1.005-1.005zm5.723-5.756H5.736a5.215 5.215 0 0 0 5.215 5.214h2.129v2.058a5.218 5.218 0 0 0 5.215 5.214V6.758a1.001 1.001 0 0 0-1.001-1.001zM23.013 0H11.455a5.215 5.215 0 0 0 5.215 5.215h2.129v2.057A5.215 5.215 0 0 0 24 12.483V1.005A1.001 1.001 0 0 0 23.013 0Z"},"child":[]}]})(props);
|
|
1526
1563
|
}
|
|
1527
1564
|
|
|
1528
|
-
var styles$
|
|
1565
|
+
var styles$7 = {"tabs":"Tabs-module_tabs__Vlvn7","tab":"Tabs-module_tab__uQKim","tabIcon":"Tabs-module_tabIcon__AgN-O"};
|
|
1529
1566
|
|
|
1530
1567
|
// Default tabs for backwards compatibility
|
|
1531
1568
|
const defaultTabs = [
|
|
@@ -1536,19 +1573,220 @@ const defaultTabs = [
|
|
|
1536
1573
|
];
|
|
1537
1574
|
const Tabs = ({ activeTab, onTabChange, tabs: customTabs, className = '' }) => {
|
|
1538
1575
|
const tabs = customTabs ?? defaultTabs;
|
|
1539
|
-
return (jsx("div", { className: `${styles$
|
|
1576
|
+
return (jsx("div", { className: `${styles$7.tabs} ${className}`, children: tabs.map((tab) => {
|
|
1540
1577
|
const isActive = activeTab === tab.id;
|
|
1541
|
-
return (jsxs(motion.button, { className: styles$
|
|
1578
|
+
return (jsxs(motion.button, { className: styles$7.tab, "data-active": isActive, onClick: () => onTabChange(tab.id), style: { position: 'relative' }, children: [jsx(motion.div, { animate: {
|
|
1542
1579
|
rotate: isActive ? [0, -10, 10, -5, 5, 0] : 0,
|
|
1543
1580
|
}, transition: {
|
|
1544
1581
|
rotate: {
|
|
1545
1582
|
duration: 0.5,
|
|
1546
1583
|
ease: 'easeInOut'
|
|
1547
1584
|
}
|
|
1548
|
-
}, children: tab.icon && (typeof tab.icon === 'function' ? (jsx("span", { className: styles$
|
|
1585
|
+
}, children: tab.icon && (typeof tab.icon === 'function' ? (jsx("span", { className: styles$7.tabIcon, children: React.createElement(tab.icon) })) : (jsx("span", { className: styles$7.tabIcon, children: tab.icon }))) }), jsx("span", { children: tab.label })] }, tab.id));
|
|
1549
1586
|
}) }));
|
|
1550
1587
|
};
|
|
1551
1588
|
|
|
1589
|
+
var styles$6 = {"calendar":"Calendar-module_calendar__3mIJS","loading":"Calendar-module_loading__59Z9-","loadingSpinner":"Calendar-module_loadingSpinner__7MXqV","header":"Calendar-module_header__cZHNA","navigation":"Calendar-module_navigation__PGkpY","navButton":"Calendar-module_navButton__kOe-w","title":"Calendar-module_title__oJZ7m","controls":"Calendar-module_controls__i1Z38","todayButton":"Calendar-module_todayButton__Ac9zc","viewToggle":"Calendar-module_viewToggle__Fhg2t","viewButton":"Calendar-module_viewButton__J2WY6","active":"Calendar-module_active__lIqH-","weekDays":"Calendar-module_weekDays__4J-8f","weekNumberHeader":"Calendar-module_weekNumberHeader__xhKbB","weekDay":"Calendar-module_weekDay__cg8Gr","daysGrid":"Calendar-module_daysGrid__ER0GM","weekView":"Calendar-module_weekView__bdtGs","dayCell":"Calendar-module_dayCell__TV-HR","dayNumber":"Calendar-module_dayNumber__ICH-X","today":"Calendar-module_today__eGuUU","events":"Calendar-module_events__qdbs7","event":"Calendar-module_event__Q1Zq3","eventTitle":"Calendar-module_eventTitle__XU7Wd","eventTime":"Calendar-module_eventTime__pMGEB","otherMonth":"Calendar-module_otherMonth__r6VJK","weekNumber":"Calendar-module_weekNumber__nlo50","completed":"Calendar-module_completed__B-SHI","completedIcon":"Calendar-module_completedIcon__-oDZ9","moreEvents":"Calendar-module_moreEvents__TIKaT","emptyState":"Calendar-module_emptyState__2fcj7"};
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* Calendar component - A flexible, reusable calendar for displaying events
|
|
1593
|
+
*
|
|
1594
|
+
* @component
|
|
1595
|
+
* @description
|
|
1596
|
+
* A highly customizable calendar component that can display events in month or week view.
|
|
1597
|
+
* Supports custom event types, colors, icons, and localization. Perfect for scheduling,
|
|
1598
|
+
* project management, habit tracking, or any date-based data visualization.
|
|
1599
|
+
*
|
|
1600
|
+
* @example
|
|
1601
|
+
* // Basic usage
|
|
1602
|
+
* <Calendar
|
|
1603
|
+
* events={myEvents}
|
|
1604
|
+
* onEventClick={handleEventClick}
|
|
1605
|
+
* viewMode="month"
|
|
1606
|
+
* />
|
|
1607
|
+
*
|
|
1608
|
+
* @example
|
|
1609
|
+
* // With custom configuration
|
|
1610
|
+
* <Calendar
|
|
1611
|
+
* events={projectEvents}
|
|
1612
|
+
* config={{
|
|
1613
|
+
* eventColors: { task: '#4A90E2', meeting: '#7ED321' },
|
|
1614
|
+
* maxEventsPerDay: 5,
|
|
1615
|
+
* mondayStart: true
|
|
1616
|
+
* }}
|
|
1617
|
+
* onEventClick={handleEventClick}
|
|
1618
|
+
* />
|
|
1619
|
+
*/
|
|
1620
|
+
function Calendar({ events, onEventClick, onDateClick, viewMode = 'month', initialDate = new Date(), config = {}, className = '', style = {}, loading = false, emptyState }) {
|
|
1621
|
+
const [currentDate, setCurrentDate] = useState(initialDate);
|
|
1622
|
+
const [currentViewMode, setCurrentViewMode] = useState(viewMode);
|
|
1623
|
+
const { eventColors = {}, iconRenderer, maxEventsPerDay = 3, mondayStart = false, showWeekNumbers = false, dateFormat = { month: 'long', year: 'numeric' }, locale = 'en-US', dayLabels, monthNames } = config;
|
|
1624
|
+
const defaultDayLabels = mondayStart
|
|
1625
|
+
? ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
1626
|
+
: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
1627
|
+
const finalDayLabels = dayLabels || defaultDayLabels;
|
|
1628
|
+
const calendarData = useMemo(() => {
|
|
1629
|
+
const year = currentDate.getFullYear();
|
|
1630
|
+
const month = currentDate.getMonth();
|
|
1631
|
+
let startDate;
|
|
1632
|
+
let endDate;
|
|
1633
|
+
let displayTitle;
|
|
1634
|
+
if (currentViewMode === 'week') {
|
|
1635
|
+
startDate = new Date(currentDate);
|
|
1636
|
+
const day = startDate.getDay();
|
|
1637
|
+
const diff = mondayStart
|
|
1638
|
+
? startDate.getDate() - day + (day === 0 ? -6 : 1)
|
|
1639
|
+
: startDate.getDate() - day;
|
|
1640
|
+
startDate = new Date(startDate.setDate(diff));
|
|
1641
|
+
startDate.setHours(0, 0, 0, 0);
|
|
1642
|
+
endDate = new Date(startDate);
|
|
1643
|
+
endDate.setDate(endDate.getDate() + 6);
|
|
1644
|
+
const weekStart = startDate.toLocaleDateString(locale, { day: 'numeric', month: 'short' });
|
|
1645
|
+
const weekEnd = endDate.toLocaleDateString(locale, { day: 'numeric', month: 'short' });
|
|
1646
|
+
displayTitle = `${weekStart} - ${weekEnd}`;
|
|
1647
|
+
}
|
|
1648
|
+
else {
|
|
1649
|
+
const firstDay = new Date(year, month, 1);
|
|
1650
|
+
const lastDay = new Date(year, month + 1, 0);
|
|
1651
|
+
startDate = new Date(firstDay);
|
|
1652
|
+
const firstDayWeek = mondayStart
|
|
1653
|
+
? (firstDay.getDay() + 6) % 7
|
|
1654
|
+
: firstDay.getDay();
|
|
1655
|
+
startDate.setDate(startDate.getDate() - firstDayWeek);
|
|
1656
|
+
endDate = new Date(lastDay);
|
|
1657
|
+
const lastDayWeek = mondayStart
|
|
1658
|
+
? (lastDay.getDay() + 6) % 7
|
|
1659
|
+
: lastDay.getDay();
|
|
1660
|
+
endDate.setDate(endDate.getDate() + (6 - lastDayWeek));
|
|
1661
|
+
if (monthNames && monthNames[month]) {
|
|
1662
|
+
displayTitle = `${monthNames[month]} ${year}`;
|
|
1663
|
+
}
|
|
1664
|
+
else {
|
|
1665
|
+
displayTitle = currentDate.toLocaleDateString(locale, dateFormat);
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
const days = [];
|
|
1669
|
+
const current = new Date(startDate);
|
|
1670
|
+
while (current <= endDate) {
|
|
1671
|
+
days.push(new Date(current));
|
|
1672
|
+
current.setDate(current.getDate() + 1);
|
|
1673
|
+
}
|
|
1674
|
+
return { days, displayTitle };
|
|
1675
|
+
}, [currentDate, currentViewMode, mondayStart, locale, dateFormat, monthNames]);
|
|
1676
|
+
const getDayEvents = (day) => {
|
|
1677
|
+
const dayEvents = events.filter(event => {
|
|
1678
|
+
const eventDate = new Date(event.date);
|
|
1679
|
+
return eventDate.toDateString() === day.toDateString();
|
|
1680
|
+
});
|
|
1681
|
+
// Sort events by time in week view
|
|
1682
|
+
if (currentViewMode === 'week') {
|
|
1683
|
+
return dayEvents.sort((a, b) => {
|
|
1684
|
+
const timeA = a.time ? convertTimeToMinutes(a.time) : 999999;
|
|
1685
|
+
const timeB = b.time ? convertTimeToMinutes(b.time) : 999999;
|
|
1686
|
+
return timeA - timeB;
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
return dayEvents;
|
|
1690
|
+
};
|
|
1691
|
+
const convertTimeToMinutes = (time) => {
|
|
1692
|
+
const [hours, minutes] = time.split(':').map(Number);
|
|
1693
|
+
return hours * 60 + minutes;
|
|
1694
|
+
};
|
|
1695
|
+
const handlePrevious = () => {
|
|
1696
|
+
const newDate = new Date(currentDate);
|
|
1697
|
+
if (currentViewMode === 'week') {
|
|
1698
|
+
newDate.setDate(newDate.getDate() - 7);
|
|
1699
|
+
}
|
|
1700
|
+
else {
|
|
1701
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
1702
|
+
}
|
|
1703
|
+
setCurrentDate(newDate);
|
|
1704
|
+
};
|
|
1705
|
+
const handleNext = () => {
|
|
1706
|
+
const newDate = new Date(currentDate);
|
|
1707
|
+
if (currentViewMode === 'week') {
|
|
1708
|
+
newDate.setDate(newDate.getDate() + 7);
|
|
1709
|
+
}
|
|
1710
|
+
else {
|
|
1711
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
1712
|
+
}
|
|
1713
|
+
setCurrentDate(newDate);
|
|
1714
|
+
};
|
|
1715
|
+
const handleToday = () => {
|
|
1716
|
+
setCurrentDate(new Date());
|
|
1717
|
+
};
|
|
1718
|
+
const getEventColor = (event) => {
|
|
1719
|
+
if (event.color)
|
|
1720
|
+
return event.color;
|
|
1721
|
+
if (event.type && eventColors[event.type])
|
|
1722
|
+
return eventColors[event.type];
|
|
1723
|
+
// Default color scheme based on priority
|
|
1724
|
+
const defaultColors = {
|
|
1725
|
+
high: '#FF4444',
|
|
1726
|
+
medium: '#FFA500',
|
|
1727
|
+
low: '#4A90E2'
|
|
1728
|
+
};
|
|
1729
|
+
if (event.priority && defaultColors[event.priority]) {
|
|
1730
|
+
return defaultColors[event.priority];
|
|
1731
|
+
}
|
|
1732
|
+
return '#4A90E2'; // Default blue
|
|
1733
|
+
};
|
|
1734
|
+
const handleEventClick = (event) => {
|
|
1735
|
+
if (onEventClick) {
|
|
1736
|
+
onEventClick(event);
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
const handleDateClick = (date) => {
|
|
1740
|
+
if (onDateClick) {
|
|
1741
|
+
onDateClick(date);
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
const isToday = (date) => {
|
|
1745
|
+
const today = new Date();
|
|
1746
|
+
return date.toDateString() === today.toDateString();
|
|
1747
|
+
};
|
|
1748
|
+
const isCurrentMonth = (date) => {
|
|
1749
|
+
return date.getMonth() === currentDate.getMonth();
|
|
1750
|
+
};
|
|
1751
|
+
const getWeekNumber = (date) => {
|
|
1752
|
+
const start = new Date(date.getFullYear(), 0, 1);
|
|
1753
|
+
const diff = date.getTime() - start.getTime();
|
|
1754
|
+
const oneWeek = 1000 * 60 * 60 * 24 * 7;
|
|
1755
|
+
return Math.floor(diff / oneWeek) + 1;
|
|
1756
|
+
};
|
|
1757
|
+
if (loading) {
|
|
1758
|
+
return (jsx("div", { className: `${styles$6.calendar} ${styles$6.loading} ${className}`, style: style, children: jsx("div", { className: styles$6.loadingSpinner, children: "Loading..." }) }));
|
|
1759
|
+
}
|
|
1760
|
+
return (jsxs("div", { className: `${styles$6.calendar} ${className}`, style: style, children: [jsxs("div", { className: styles$6.header, children: [jsxs("div", { className: styles$6.navigation, children: [jsx("button", { onClick: handlePrevious, className: styles$6.navButton, "aria-label": "Previous", children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: jsx("polyline", { points: "15,18 9,12 15,6" }) }) }), jsx("h3", { className: styles$6.title, children: calendarData.displayTitle }), jsx("button", { onClick: handleNext, className: styles$6.navButton, "aria-label": "Next", children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: jsx("polyline", { points: "9,6 15,12 9,18" }) }) })] }), jsxs("div", { className: styles$6.controls, children: [jsx("button", { onClick: handleToday, className: styles$6.todayButton, children: "Today" }), jsxs("div", { className: styles$6.viewToggle, children: [jsx("button", { className: `${styles$6.viewButton} ${currentViewMode === 'month' ? styles$6.active : ''}`, onClick: () => setCurrentViewMode('month'), children: "Month" }), jsx("button", { className: `${styles$6.viewButton} ${currentViewMode === 'week' ? styles$6.active : ''}`, onClick: () => setCurrentViewMode('week'), children: "Week" })] })] })] }), jsxs("div", { className: styles$6.weekDays, children: [showWeekNumbers && jsx("div", { className: styles$6.weekNumberHeader, children: "Week" }), finalDayLabels.map((day) => (jsx("div", { className: styles$6.weekDay, children: day }, day)))] }), jsx("div", { className: `${styles$6.daysGrid} ${currentViewMode === 'week' ? styles$6.weekView : ''}`, children: calendarData.days.map((day, index) => {
|
|
1761
|
+
const dayEvents = getDayEvents(day);
|
|
1762
|
+
const dayIsToday = isToday(day);
|
|
1763
|
+
const isInCurrentMonth = currentViewMode === 'week' || isCurrentMonth(day);
|
|
1764
|
+
const isWeekStart = showWeekNumbers && (index % 7 === 0);
|
|
1765
|
+
return (jsxs(motion.div, { className: `${styles$6.dayCell} ${dayIsToday ? styles$6.today : ''} ${!isInCurrentMonth ? styles$6.otherMonth : ''}`, initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: {
|
|
1766
|
+
duration: 0.3,
|
|
1767
|
+
delay: index * 0.02,
|
|
1768
|
+
ease: "easeOut"
|
|
1769
|
+
}, onClick: () => handleDateClick(day), children: [isWeekStart && (jsx("div", { className: styles$6.weekNumber, children: getWeekNumber(day) })), jsx("div", { className: styles$6.dayNumber, children: day.getDate() }), dayEvents.length > 0 && (jsxs("div", { className: styles$6.events, children: [dayEvents.slice(0, maxEventsPerDay).map((event, eventIndex) => (jsxs(motion.div, { className: `${styles$6.event} ${event.status === 'completed' ? styles$6.completed : ''}`, style: {
|
|
1770
|
+
backgroundColor: getEventColor(event),
|
|
1771
|
+
opacity: event.status === 'completed' ? 0.7 : 1
|
|
1772
|
+
}, onClick: (e) => {
|
|
1773
|
+
e.stopPropagation();
|
|
1774
|
+
handleEventClick(event);
|
|
1775
|
+
}, initial: { opacity: 0, x: -10 }, animate: { opacity: 1, x: 0 }, transition: {
|
|
1776
|
+
duration: 0.2,
|
|
1777
|
+
delay: eventIndex * 0.05,
|
|
1778
|
+
ease: "easeOut"
|
|
1779
|
+
}, whileHover: {
|
|
1780
|
+
scale: 1.02,
|
|
1781
|
+
y: -1,
|
|
1782
|
+
transition: { duration: 0.1 }
|
|
1783
|
+
}, whileTap: {
|
|
1784
|
+
scale: 0.98,
|
|
1785
|
+
transition: { duration: 0.1 }
|
|
1786
|
+
}, children: [iconRenderer && iconRenderer(event), jsxs("span", { className: styles$6.eventTitle, children: [event.time && (jsx("span", { className: styles$6.eventTime, children: event.time })), event.title] }), event.status === 'completed' && (jsx("svg", { className: styles$6.completedIcon, width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: jsx("polyline", { points: "20,6 9,17 4,12" }) }))] }, event.id))), dayEvents.length > maxEventsPerDay && (jsxs("div", { className: styles$6.moreEvents, children: ["+", dayEvents.length - maxEventsPerDay, " more"] }))] })), dayEvents.length === 0 && emptyState && (jsx("div", { className: styles$6.emptyState, children: emptyState }))] }, `${day.getFullYear()}-${day.getMonth()}-${day.getDate()}`));
|
|
1787
|
+
}) })] }));
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1552
1790
|
var desktopStyles = {"navbar":"Navbar-module_navbar__-SNiN","navbarSidebar":"Navbar-module_navbarSidebar__RVVL8","navbarTop":"Navbar-module_navbarTop__MLI-S","navList":"Navbar-module_navList__764oY","navItem":"Navbar-module_navItem__cbeLP","navbarMinimal":"Navbar-module_navbarMinimal__7gs0n","navLogo":"Navbar-module_navLogo__y0AxI","logoContainer":"Navbar-module_logoContainer__zJG3x","logoImage":"Navbar-module_logoImage__1Ptmz","logoPlaceholder":"Navbar-module_logoPlaceholder__aIREi","logoContent":"Navbar-module_logoContent__CjPyL","logoText":"Navbar-module_logoText__bTwI0","logoSubtitle":"Navbar-module_logoSubtitle__UA95I","subNavItem":"Navbar-module_subNavItem__WN9is","navLink":"Navbar-module_navLink__I-45k","active":"Navbar-module_active__tLLqx","activeBackground":"Navbar-module_activeBackground__ikyOn","navIcon":"Navbar-module_navIcon__uU4yD","activeIcon":"Navbar-module_activeIcon__omRDk","navText":"Navbar-module_navText__4e0cK","activeText":"Navbar-module_activeText__zSzJC","navBadge":"Navbar-module_navBadge__mLur9","chevron":"Navbar-module_chevron__nmRNk","subNavList":"Navbar-module_subNavList__YsOQP","navFooter":"Navbar-module_navFooter__p1wMO","mobileMenuButton":"Navbar-module_mobileMenuButton__BrALw","mobileBackdrop":"Navbar-module_mobileBackdrop__bgxCV","mobileMenuOpen":"Navbar-module_mobileMenuOpen__oICVa"};
|
|
1553
1791
|
|
|
1554
1792
|
var mobileStyles = {"navbar":"Navbar-mobile-module_navbar__-shkE","navLogo":"Navbar-mobile-module_navLogo__7Gnna","navList":"Navbar-mobile-module_navList__FBo8I","navItem":"Navbar-mobile-module_navItem__-9E9-","navLink":"Navbar-mobile-module_navLink__A8n8F","active":"Navbar-mobile-module_active__h3ajz","activeBackground":"Navbar-mobile-module_activeBackground__btXAN","navIcon":"Navbar-mobile-module_navIcon__4L17v","activeIcon":"Navbar-mobile-module_activeIcon__A8GF-","navText":"Navbar-mobile-module_navText__ewf-i","activeText":"Navbar-mobile-module_activeText__fNqcU","navBadge":"Navbar-mobile-module_navBadge__YccGx","chevron":"Navbar-mobile-module_chevron__nBPqn","subNavList":"Navbar-mobile-module_subNavList__8tINc","navFooter":"Navbar-mobile-module_navFooter__yijWu","mobileMenuButton":"Navbar-mobile-module_mobileMenuButton__Dx3t8","mobileBackdrop":"Navbar-mobile-module_mobileBackdrop__biYng","navbarTop":"Navbar-mobile-module_navbarTop__oyfPE","navbarMinimal":"Navbar-mobile-module_navbarMinimal__cudny"};
|
|
@@ -2558,5 +2796,5 @@ const PieChart = ({ data, width = 400, height = 400, title = 'Distribution', sho
|
|
|
2558
2796
|
} }), jsx("span", { className: styles.legendLabel, children: item.name }), jsx("span", { className: styles.legendValue, children: item.value.toLocaleString() })] }, item.name))) }))] })] }));
|
|
2559
2797
|
};
|
|
2560
2798
|
|
|
2561
|
-
export { ArrayInput, BooleansHeatmap, Button, Card, Checkbox, DateInput, EditFAB, MoodChart, Navbar, NumberStepper, PieChart, QuantifiableHabitsChart, SearchBar, SearchableDropdown, SelectInput, SleepChart, SunburstChart, Tabs, TextArea, TextInput, ThemeProvider, ThemeSwitcher, TimeInput, Toggle, ToggleButton, useTheme$1 as useTheme };
|
|
2799
|
+
export { ArrayInput, BooleansHeatmap, Button, Calendar, Card, Checkbox, DateInput, EditFAB, MoodChart, Navbar, NumberStepper, PieChart, QuantifiableHabitsChart, SearchBar, SearchableDropdown, SelectInput, SleepChart, SunburstChart, Tabs, TextArea, TextInput, ThemeProvider, ThemeSwitcher, TimeInput, Toggle, ToggleButton, useTheme$1 as useTheme };
|
|
2562
2800
|
//# sourceMappingURL=index.esm.js.map
|