@moontra/moonui 6.13.0 → 6.15.0

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.
@@ -200,6 +200,13 @@ export const DatePicker = React.forwardRef<HTMLDivElement, DatePickerProps>(func
200
200
 
201
201
  return (
202
202
  <div ref={ref} className="moonui-theme">
203
+ {/* #345: temizle kontrolü tetikleyici <button>ın İÇİNDEydi ve kendisi de
204
+ role="button" + tabIndex taşıyordu — hem `nested-interactive` (ARIA'da bir
205
+ button başka etkileşimli öğe içeremez) hem de geçersiz HTML (interactive
206
+ content model). #332'de tabs-pro kapat butonunda uygulanan desenle KARDEŞ
207
+ konuma alındı ve gerçek <button> oldu: rol taklidi, elle yazılmış Enter/Space
208
+ işleyicisi ve tabIndex artık gereksiz — tarayıcı hepsini kendisi verir. */}
209
+ <div className="relative">
203
210
  <Popover open={open} onOpenChange={setOpen}>
204
211
  <PopoverTrigger asChild>
205
212
  <Button
@@ -207,6 +214,9 @@ export const DatePicker = React.forwardRef<HTMLDivElement, DatePickerProps>(func
207
214
  className={cn(
208
215
  datePickerVariants({ variant, size, state }),
209
216
  !displayValue && "text-muted-foreground",
217
+ // #345: temizle butonu artık MUTLAK konumlu bir kardeş — uzun tarih
218
+ // metninin altına girmemesi için sağda yer ayrılıyor.
219
+ allowClear && displayValue && !readOnly && !disabled && "pr-9",
210
220
  className
211
221
  )}
212
222
  disabled={disabled || readOnly}
@@ -228,41 +238,6 @@ export const DatePicker = React.forwardRef<HTMLDivElement, DatePickerProps>(func
228
238
  {iconPosition === "right" && iconElement}
229
239
  </motion.div>
230
240
  </AnimatePresence>
231
- {allowClear && displayValue && !readOnly && !disabled && (
232
- <motion.div
233
- initial={{ opacity: 0, scale: 0.8 }}
234
- animate={{ opacity: 1, scale: 1 }}
235
- exit={{ opacity: 0, scale: 0.8 }}
236
- whileHover={{ scale: 1.1 }}
237
- whileTap={{ scale: 0.9 }}
238
- className="ml-2 h-4 w-4 shrink-0 opacity-50 hover:opacity-100 transition-opacity cursor-pointer"
239
- onClick={handleClear}
240
- role="button"
241
- tabIndex={0}
242
- onKeyDown={(e) => {
243
- if (e.key === 'Enter' || e.key === ' ') {
244
- e.preventDefault();
245
- handleClear(e);
246
- }
247
- }}
248
- >
249
- <span className="sr-only">Clear date</span>
250
- <svg
251
- width="15"
252
- height="15"
253
- viewBox="0 0 15 15"
254
- fill="none"
255
- xmlns="http://www.w3.org/2000/svg"
256
- >
257
- <path
258
- d="M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z"
259
- fill="currentColor"
260
- fillRule="evenodd"
261
- clipRule="evenodd"
262
- />
263
- </svg>
264
- </motion.div>
265
- )}
266
241
  </Button>
267
242
  </PopoverTrigger>
268
243
  <PopoverContent
@@ -297,7 +272,32 @@ export const DatePicker = React.forwardRef<HTMLDivElement, DatePickerProps>(func
297
272
  )}
298
273
  </motion.div>
299
274
  </PopoverContent>
300
- </Popover>
275
+ </Popover>
276
+ {allowClear && displayValue && !readOnly && !disabled && (
277
+ <button
278
+ type="button"
279
+ onClick={handleClear}
280
+ aria-label="Clear date"
281
+ className="absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 shrink-0 opacity-50 hover:opacity-100 transition-opacity"
282
+ >
283
+ <svg
284
+ width="15"
285
+ height="15"
286
+ viewBox="0 0 15 15"
287
+ fill="none"
288
+ aria-hidden="true"
289
+ xmlns="http://www.w3.org/2000/svg"
290
+ >
291
+ <path
292
+ d="M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z"
293
+ fill="currentColor"
294
+ fillRule="evenodd"
295
+ clipRule="evenodd"
296
+ />
297
+ </svg>
298
+ </button>
299
+ )}
300
+ </div>
301
301
  </div>
302
302
  );
303
303
  });