@ayseaistudio/ui-components 3.12.1 → 3.12.3

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.
@@ -21,10 +21,11 @@ interface Props {
21
21
  onDaySelection?: (dates: Date[]) => void;
22
22
  maxDate?: Date;
23
23
  highlightWeekSelection?: boolean;
24
- selectionVariant?: "single" | "multi" | "week";
24
+ selectionVariant?: "single" | "multi" | "week" | "range";
25
+ onClearRange?: () => void;
25
26
  }
26
27
  export declare const Calendar: {
27
- ({ property1, className, tertiaryButtonIcon, override, showPrevButton, showNextButton, padToSixWeeks, disableOutsideDays, month, year, value, onChange, selectionMode, values, onChangeMultiple, appointmentDates, onDaySelection, maxDate, highlightWeekSelection, selectionVariant, }: Props): React.JSX.Element;
28
+ ({ property1, className, tertiaryButtonIcon, override, showPrevButton, showNextButton, padToSixWeeks, disableOutsideDays, month, year, value, onChange, selectionMode, values, onChangeMultiple, appointmentDates, onDaySelection, maxDate, highlightWeekSelection, selectionVariant, onClearRange, }: Props): React.JSX.Element;
28
29
  propTypes: {
29
30
  property1: PropTypes.Requireable<string>;
30
31
  divideDashedWrapperDivideHorizontalDivide: PropTypes.Requireable<string>;
@@ -36,6 +37,7 @@ export declare const Calendar: {
36
37
  year: PropTypes.Requireable<number>;
37
38
  highlightWeekSelection: PropTypes.Requireable<boolean>;
38
39
  selectionVariant: PropTypes.Requireable<string>;
40
+ onClearRange: PropTypes.Requireable<(...args: any[]) => any>;
39
41
  };
40
42
  };
41
43
  export {};
@@ -12,13 +12,13 @@ const normalizeVariantInput = (value) => {
12
12
  const normalized = value.toLowerCase();
13
13
  if (normalized === "single")
14
14
  return "single";
15
- if (normalized === "multi" || normalized === "multiple")
15
+ if (normalized === "multi" || normalized === "multiple" || normalized === "range")
16
16
  return "multi";
17
17
  if (normalized === "week" || normalized === "weekly")
18
18
  return "week";
19
19
  return undefined;
20
20
  };
21
- export const Calendar = ({ property1, className, tertiaryButtonIcon = (_jsx(IconChevronLeft, { size: 20, color: "#6D6D6D" })), override = _jsx(IconChevronRight, { size: 20, color: "#6D6D6D" }), showPrevButton = true, showNextButton = true, padToSixWeeks = true, disableOutsideDays = false, month, year, value, onChange, selectionMode, values, onChangeMultiple, appointmentDates = [], onDaySelection, maxDate, highlightWeekSelection = true, selectionVariant, }) => {
21
+ export const Calendar = ({ property1, className, tertiaryButtonIcon = (_jsx(IconChevronLeft, { size: 20, color: "#6D6D6D" })), override = _jsx(IconChevronRight, { size: 20, color: "#6D6D6D" }), showPrevButton = true, showNextButton = true, padToSixWeeks = true, disableOutsideDays = false, month, year, value, onChange, selectionMode, values, onChangeMultiple, appointmentDates = [], onDaySelection, maxDate, highlightWeekSelection = true, selectionVariant, onClearRange, }) => {
22
22
  const effectiveVariant = React.useMemo(() => {
23
23
  // Accept both selectionVariant and selectionMode, with case-insensitive + legacy aliases
24
24
  const fromVariant = normalizeVariantInput(selectionVariant);
@@ -66,10 +66,14 @@ export const Calendar = ({ property1, className, tertiaryButtonIcon = (_jsx(Icon
66
66
  const last = sorted[sorted.length - 1];
67
67
  if (first instanceof Date && last instanceof Date) {
68
68
  setRangeStart(first);
69
- setRangeEnd(last);
69
+ setRangeEnd(sorted.length > 1 ? last : null);
70
70
  setCurrentMonth(first.getMonth());
71
71
  setCurrentYear(first.getFullYear());
72
72
  }
73
+ else {
74
+ setRangeStart(null);
75
+ setRangeEnd(null);
76
+ }
73
77
  }
74
78
  else {
75
79
  setRangeStart(null);
@@ -322,7 +326,8 @@ export const Calendar = ({ property1, className, tertiaryButtonIcon = (_jsx(Icon
322
326
  }
323
327
  return (_jsxs("div", { className: `calendar ${className} ${property1 ? `size-${property1}` : ""}`, children: [_jsxs("div", { className: "top", children: [showPrevButton && (_jsx(TertiaryButton, { color: "black", leftIcon: tertiaryButtonIcon, size: "large", status: "default", onClick: prevMonth, "aria-label": "\u00D6nceki ay" })), _jsxs("div", { className: "label-13", children: [_jsx(Label, { bold: "on", className: "label-14", color: "black", size: "large", spacing: "on", stroke: "off", text: monthNames[currentMonth], version: "primary" }), _jsx(Label, { bold: "on", className: "label-14-year", color: "black", size: "small", spacing: "off", stroke: "off", text: currentYear.toString(), version: "secondary" })] }), showNextButton && (_jsx(TertiaryButton, { color: "black", leftIcon: override, size: "large", status: "default", onClick: nextMonth, "aria-label": "Sonraki ay" }))] }), _jsx("div", { className: "divide-dashed-12" }), _jsxs("div", { className: "days", children: [_jsx(Label, { bold: "off", className: "label-15", color: "black", size: "small", spacing: "on", stroke: "off", text: "Pzt.", version: "primary" }), _jsx(Label, { bold: "off", className: "label-15", color: "black", size: "small", spacing: "on", stroke: "off", text: "Sal.", version: "primary" }), _jsx(Label, { bold: "off", className: "label-15", color: "black", size: "small", spacing: "on", stroke: "off", text: "\u00C7ar.", version: "primary" }), _jsx(Label, { bold: "off", className: "label-15", color: "black", size: "small", spacing: "on", stroke: "off", text: "Per.", version: "primary" }), _jsx(Label, { bold: "off", className: "label-15", color: "black", size: "small", spacing: "on", stroke: "off", text: "Cum.", version: "primary" }), _jsx(Label, { bold: "off", className: "label-15", color: "black", size: "small", spacing: "on", stroke: "off", text: "Cmt.", version: "primary" }), _jsx(Label, { bold: "off", className: "label-15", color: "black", size: "small", spacing: "on", stroke: "off", text: "Pzr.", version: "primary" })] }), _jsx("div", { className: "weeks", children: weeks.map((week, wi) => {
324
328
  const isWeekMode = effectiveVariant === "week";
325
- const weekHasSelection = highlightWeekSelection && !isWeekMode && week.some((d) => d.currentMonth && ((selectedDays || []).includes(d.day) || d.day === selectedDay));
329
+ // Haftalık görünümde tüm haftayı boyamak için kullanılır; tarih aralığı (multi) modunda devre dışı.
330
+ const weekHasSelection = highlightWeekSelection && isWeekMode && week.some((d) => d.currentMonth && ((selectedDays || []).includes(d.day) || d.day === selectedDay));
326
331
  return (_jsx("div", { className: `week${weekHasSelection ? " selected-week" : ""}${isWeekMode ? " week-mode" : ""}`, children: week.map((day, di) => {
327
332
  const cellKey = `w${wi}-d${di}`;
328
333
  const isToday = day.currentMonth &&
@@ -383,7 +388,7 @@ export const Calendar = ({ property1, className, tertiaryButtonIcon = (_jsx(Icon
383
388
  : getStatusForDay(day, cellDate);
384
389
  return day ? (_jsx("div", { className: `calendar-year-day-clickable${isDisabled ? " disabled" : ""}${isRangeCell ? " week-range" : ""}${isStartCell ? " week-start" : ""}${isEndCell ? " week-end" : ""}`, onMouseDown: (e) => e.preventDefault(), onClick: () => handleSelectDate(cellDate, day.currentMonth, weekDates), children: _jsx(CalendarYearDay, { className: `calendar-year-day-instance ${day.currentMonth ? 'current-month' : 'other-month'}${isToday ? ' today' : ''}`, size: "medium", status: status, text: day.day.toString(), taskCount: taskCount, version: day.currentMonth ? "month-day" : "different-month-day" }) }, cellKey)) : (_jsx("div", { className: "calendar-year-day-empty" }, cellKey));
385
390
  }) }, `week-${wi}`));
386
- }) })] }));
391
+ }) }), onClearRange && (_jsx("button", { type: "button", className: "date-range-clear-button", onClick: onClearRange, children: "Temizle" }))] }));
387
392
  };
388
393
  Calendar.propTypes = {
389
394
  property1: PropTypes.oneOf(["medium"]),
@@ -395,5 +400,6 @@ Calendar.propTypes = {
395
400
  month: PropTypes.number,
396
401
  year: PropTypes.number,
397
402
  highlightWeekSelection: PropTypes.bool,
398
- selectionVariant: PropTypes.oneOf(["single", "multi", "week"]),
403
+ selectionVariant: PropTypes.oneOf(["single", "multi", "week", "range"]),
404
+ onClearRange: PropTypes.func,
399
405
  };
@@ -1,5 +1,5 @@
1
1
  .calendar {
2
- align-items: flex-start;
2
+ align-items: flex-end;
3
3
  background-color: #ffffff;
4
4
  border: 1px solid;
5
5
  border-color: #e7e7e7;
@@ -17,7 +17,6 @@ export const LoginInput = ({ withIcon = true, placeholder = "Enter text", status
17
17
  const [state, dispatch] = useReducer(reducer, { status });
18
18
  const [isFocused, setIsFocused] = useState(false);
19
19
  const [inputValue, setInputValue] = useState(value);
20
- const [actualType, setActualType] = useState("text");
21
20
  const [showPassword, setShowPassword] = useState(false);
22
21
  const hasPasswordToggle = version === "password";
23
22
  const autoCompleteType = version === "username"
@@ -45,17 +44,10 @@ export const LoginInput = ({ withIcon = true, placeholder = "Enter text", status
45
44
  else if (icon && React.isValidElement(icon)) {
46
45
  finalIcon = React.cloneElement(icon, { color: iconColor });
47
46
  }
48
- useEffect(() => {
49
- if (version === "password") {
50
- const timer = setTimeout(() => {
51
- setActualType(showPassword ? "text" : "password");
52
- }, 100);
53
- return () => clearTimeout(timer);
54
- }
55
- }, [version, showPassword]);
56
47
  useEffect(() => {
57
48
  setInputValue(value || "");
58
49
  }, [value]);
50
+ const resolvedInputType = version === "password" ? (showPassword ? "text" : "password") : finalInputType;
59
51
  const handleInputChange = (e) => {
60
52
  const rawValue = e.target.value;
61
53
  const nextValue = singleChar ? rawValue.slice(0, 1) : rawValue;
@@ -87,7 +79,7 @@ export const LoginInput = ({ withIcon = true, placeholder = "Enter text", status
87
79
  }, onMouseEnter: () => {
88
80
  if (state.status !== "selected")
89
81
  dispatch("mouse_enter");
90
- }, children: [_jsxs("div", { className: `placeholder-container ${isFocused || inputValue ? "active" : ""}`, children: [withIcon && _jsx("span", { className: "icon-container", children: finalIcon }), _jsx("label", { className: "placeholder", htmlFor: "login-input", children: finalPlaceholder })] }), _jsx("input", { id: `login-input-${version}`, className: `input-field ${hasPasswordToggle ? "with-password-toggle" : ""}`, type: version === "password" ? actualType : finalInputType, value: inputValue, onChange: handleInputChange, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: onKeyDown, autoComplete: autoCompleteType, autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", name: inputName, maxLength: singleChar ? 1 : undefined, ref: inputRef }), hasPasswordToggle && (_jsx("button", { type: "button", className: "password-toggle", onClick: togglePasswordVisibility, tabIndex: 0, children: showPassword ? (_jsx(IconEyeOff, { size: 24, strokeWidth: 1.5 })) : (_jsx(IconEye, { size: 24, strokeWidth: 1.5 })) }))] }));
82
+ }, children: [_jsxs("div", { className: `placeholder-container ${isFocused || inputValue ? "active" : ""}`, children: [withIcon && _jsx("span", { className: "icon-container", children: finalIcon }), _jsx("label", { className: "placeholder", htmlFor: `login-input-${version}`, children: finalPlaceholder })] }), _jsx("input", { id: `login-input-${version}`, className: `input-field ${hasPasswordToggle ? "with-password-toggle" : ""}`, type: resolvedInputType, value: inputValue, onChange: handleInputChange, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: onKeyDown, autoComplete: autoCompleteType, autoCorrect: "off", autoCapitalize: "off", spellCheck: false, name: inputName, maxLength: singleChar ? 1 : undefined, ref: inputRef }), hasPasswordToggle && (_jsx("button", { type: "button", className: "password-toggle", onClick: togglePasswordVisibility, tabIndex: 0, children: showPassword ? (_jsx(IconEyeOff, { size: 24, strokeWidth: 1.5 })) : (_jsx(IconEye, { size: 24, strokeWidth: 1.5 })) }))] }));
91
83
  };
92
84
  function reducer(state, action) {
93
85
  switch (action) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayseaistudio/ui-components",
3
- "version": "3.12.1",
3
+ "version": "3.12.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,14 +12,19 @@
12
12
  "react-dom": ">=18.0.0"
13
13
  },
14
14
  "scripts": {
15
+ "dev": "vite",
15
16
  "build": "tsc && cpy \"src/**/*.css\" dist --parents"
16
17
  },
17
18
  "devDependencies": {
18
19
  "@types/prop-types": "^15.7.15",
19
20
  "@types/react": "^19.2.2",
20
21
  "@types/react-dom": "^19.2.2",
22
+ "@vitejs/plugin-react": "^6.0.1",
21
23
  "cpy-cli": "^6.0.0",
22
- "typescript": "^5.9.3"
24
+ "react": "^19.2.4",
25
+ "react-dom": "^19.2.4",
26
+ "typescript": "^5.9.3",
27
+ "vite": "^8.0.1"
23
28
  },
24
29
  "dependencies": {
25
30
  "@tabler/icons-react": "^3.35.0",