@dmsi/wedgekit-react 0.0.230 → 0.0.232
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/{chunk-2RUQFWER.js → chunk-2VRZB2A4.js} +1 -1
- package/dist/{chunk-A76MF7ZO.js → chunk-3M23BFB4.js} +2 -2
- package/dist/{chunk-7W4I2NK3.js → chunk-5JVMULVC.js} +12 -2
- package/dist/{chunk-2WRRRPEB.js → chunk-7BBXPM5C.js} +1 -1
- package/dist/{chunk-XOUEHNCC.js → chunk-Q7ETEWBW.js} +1 -1
- package/dist/chunk-SQJ7MWY7.js +493 -0
- package/dist/chunk-VZVPD3XK.js +1182 -0
- package/dist/components/CalendarRange.cjs +4066 -224
- package/dist/components/CalendarRange.css +4831 -0
- package/dist/components/CalendarRange.js +23 -1
- package/dist/components/DataGridCell.cjs +12 -2
- package/dist/components/DataGridCell.js +3 -3
- package/dist/components/DateInput.cjs +3682 -329
- package/dist/components/DateInput.css +4831 -0
- package/dist/components/DateInput.js +23 -5
- package/dist/components/DateRangeInput.cjs +3682 -329
- package/dist/components/DateRangeInput.css +4831 -0
- package/dist/components/DateRangeInput.js +23 -5
- package/dist/components/FilterGroup.cjs +12 -2
- package/dist/components/FilterGroup.js +7 -7
- package/dist/components/Input.cjs +12 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/MobileDataGrid.js +3 -3
- package/dist/components/Modal.js +4 -4
- package/dist/components/ModalButtons.js +2 -2
- package/dist/components/ModalHeader.js +2 -2
- package/dist/components/NavigationTab.js +2 -2
- package/dist/components/NavigationTabs.js +2 -2
- package/dist/components/Notification.js +3 -3
- package/dist/components/OptionPill.js +2 -2
- package/dist/components/PDFViewer.js +6 -6
- package/dist/components/Password.cjs +12 -2
- package/dist/components/Password.js +1 -1
- package/dist/components/Search.cjs +12 -2
- package/dist/components/Search.js +2 -2
- package/dist/components/Select.cjs +12 -2
- package/dist/components/Select.js +2 -2
- package/dist/components/Stepper.cjs +12 -2
- package/dist/components/Stepper.js +4 -4
- package/dist/components/Time.cjs +12 -2
- package/dist/components/Time.js +1 -1
- package/dist/components/Toast.js +3 -3
- package/dist/components/Upload.js +3 -3
- package/dist/components/index.cjs +12 -2
- package/dist/components/index.css +3 -0
- package/dist/components/index.js +12 -1142
- package/dist/index.css +3 -0
- package/package.json +1 -1
- package/src/components/CalendarRange.tsx +316 -165
- package/src/components/DateInput.tsx +1 -0
- package/src/components/DateRangeInput.tsx +1 -0
- package/src/components/Input.tsx +19 -5
- package/dist/chunk-SE5DM2IJ.js +0 -350
- package/dist/{chunk-ED7FXZRX.js → chunk-BW2MWMVM.js} +3 -3
- package/dist/{chunk-FYW64H7N.js → chunk-JFPRYMID.js} +3 -3
- package/dist/{chunk-A5ROZWIH.js → chunk-R4H6D4SZ.js} +3 -3
- package/dist/{chunk-47KTDBGA.js → chunk-T7UCZWWK.js} +3 -3
package/dist/index.css
CHANGED
package/package.json
CHANGED
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
layoutGap,
|
|
7
7
|
} from "../classNames";
|
|
8
8
|
import { Icon } from "./Icon";
|
|
9
|
-
import React, { useEffect, useState } from "react";
|
|
9
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
10
10
|
import { Temporal } from "@js-temporal/polyfill";
|
|
11
|
+
import { Menu, MenuOption } from ".";
|
|
11
12
|
|
|
12
13
|
export interface CalendarRangeProps {
|
|
13
14
|
from?: string | number;
|
|
@@ -218,6 +219,19 @@ export function CalendarRange({
|
|
|
218
219
|
};
|
|
219
220
|
}
|
|
220
221
|
|
|
222
|
+
function getMonthDataWith(monthOffset: number) {
|
|
223
|
+
const monthDate = baseMonth.with({ month: monthOffset }).with({ day: 1 });
|
|
224
|
+
const days = monthDate.daysInMonth;
|
|
225
|
+
const firstDayOffset = monthDate.dayOfWeek % 7;
|
|
226
|
+
return {
|
|
227
|
+
name: monthDate.toLocaleString("en-US", { month: "long" }),
|
|
228
|
+
year: monthDate.year,
|
|
229
|
+
days,
|
|
230
|
+
firstDayOffset,
|
|
231
|
+
date: monthDate,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
221
235
|
// Click handlers
|
|
222
236
|
function handleDayClick(date: Temporal.PlainDate) {
|
|
223
237
|
if (isDateAvailable && !isDateAvailable(date)) return;
|
|
@@ -297,177 +311,314 @@ export function CalendarRange({
|
|
|
297
311
|
)}
|
|
298
312
|
>
|
|
299
313
|
{(mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
|
|
300
|
-
const month = getMonthData(offset);
|
|
301
|
-
// Always show 6 weeks (42 days)
|
|
302
|
-
const totalCells = 42;
|
|
303
|
-
const emptyCells = month.firstDayOffset;
|
|
304
314
|
return (
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
!isInMonth ||
|
|
396
|
-
(isDateAvailable ? !isDateAvailable(date) : false);
|
|
397
|
-
// New: determine if this is the start or end of the range
|
|
315
|
+
<CalendarPane
|
|
316
|
+
key={idx}
|
|
317
|
+
getMonthData={getMonthData}
|
|
318
|
+
getMonthDataWith={getMonthDataWith}
|
|
319
|
+
offset={offset}
|
|
320
|
+
idx={idx}
|
|
321
|
+
id={id}
|
|
322
|
+
testid={testid}
|
|
323
|
+
baseMonth={baseMonth}
|
|
324
|
+
setBaseMonth={setBaseMonth}
|
|
325
|
+
mode={mode}
|
|
326
|
+
pendingFrom={pendingFrom}
|
|
327
|
+
weekDays={weekDays}
|
|
328
|
+
fromDate={fromDate}
|
|
329
|
+
toDate={toDate}
|
|
330
|
+
isDateAvailable={isDateAvailable}
|
|
331
|
+
disableRange={disableRange}
|
|
332
|
+
hoveredDate={hoveredDate}
|
|
333
|
+
isInRange={isInRange}
|
|
334
|
+
today={today}
|
|
335
|
+
setHoveredDate={setHoveredDate}
|
|
336
|
+
handleDayClick={handleDayClick}
|
|
337
|
+
/>
|
|
338
|
+
);
|
|
339
|
+
})}
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
function CalendarPane({
|
|
345
|
+
getMonthData,
|
|
346
|
+
getMonthDataWith,
|
|
347
|
+
offset,
|
|
348
|
+
idx,
|
|
349
|
+
id,
|
|
350
|
+
testid,
|
|
351
|
+
baseMonth,
|
|
352
|
+
setBaseMonth,
|
|
353
|
+
mode,
|
|
354
|
+
pendingFrom,
|
|
355
|
+
weekDays,
|
|
356
|
+
fromDate,
|
|
357
|
+
toDate,
|
|
358
|
+
isDateAvailable,
|
|
359
|
+
disableRange,
|
|
360
|
+
hoveredDate,
|
|
361
|
+
isInRange,
|
|
362
|
+
today,
|
|
363
|
+
setHoveredDate,
|
|
364
|
+
handleDayClick,
|
|
365
|
+
}: {
|
|
366
|
+
getMonthData: (offset: number) => {
|
|
367
|
+
name: string;
|
|
368
|
+
year: number;
|
|
369
|
+
days: number;
|
|
370
|
+
firstDayOffset: number;
|
|
371
|
+
date: Temporal.PlainDate;
|
|
372
|
+
};
|
|
373
|
+
getMonthDataWith: (offset: number) => {
|
|
374
|
+
name: string;
|
|
375
|
+
year: number;
|
|
376
|
+
days: number;
|
|
377
|
+
firstDayOffset: number;
|
|
378
|
+
date: Temporal.PlainDate;
|
|
379
|
+
};
|
|
380
|
+
offset: number;
|
|
381
|
+
idx: number;
|
|
382
|
+
id: string | undefined;
|
|
383
|
+
testid: string | undefined;
|
|
384
|
+
baseMonth: Temporal.PlainDate;
|
|
385
|
+
setBaseMonth: (date: Temporal.PlainDate) => void;
|
|
386
|
+
mode: "single" | "range" | "double";
|
|
387
|
+
pendingFrom: Temporal.PlainDate | undefined;
|
|
388
|
+
weekDays: string[];
|
|
389
|
+
fromDate: Temporal.PlainDate | undefined;
|
|
390
|
+
toDate: Temporal.PlainDate | undefined;
|
|
391
|
+
isDateAvailable?: (date: Temporal.PlainDate) => boolean;
|
|
392
|
+
disableRange: boolean;
|
|
393
|
+
hoveredDate: Temporal.PlainDate | undefined;
|
|
394
|
+
isInRange: (date: Temporal.PlainDate) => boolean;
|
|
395
|
+
today: Temporal.PlainDate;
|
|
396
|
+
setHoveredDate: (date: Temporal.PlainDate | undefined) => void;
|
|
397
|
+
handleDayClick: (date: Temporal.PlainDate) => void;
|
|
398
|
+
}) {
|
|
399
|
+
const months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
400
|
+
const years = Array.from({ length: 100 }).map(
|
|
401
|
+
(_, i) => baseMonth.year - 50 + i,
|
|
402
|
+
);
|
|
403
|
+
const [monthMenuOpen, setMonthMenuOpen] = useState(false);
|
|
404
|
+
const [yearMenuOpen, setYearMenuOpen] = useState(false);
|
|
398
405
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
406
|
+
const monthMenuRef = useRef<HTMLButtonElement | null>(null);
|
|
407
|
+
const yearMenuRef = useRef<HTMLButtonElement | null>(null);
|
|
408
|
+
const month = getMonthData(offset);
|
|
409
|
+
// Always show 6 weeks (42 days)
|
|
410
|
+
const totalCells = 42;
|
|
411
|
+
const emptyCells = month.firstDayOffset;
|
|
412
|
+
return (
|
|
413
|
+
<React.Fragment key={month.name + month.year}>
|
|
414
|
+
<div
|
|
415
|
+
// key={month.name + month.year}
|
|
416
|
+
className={clsx("flex flex-col")}
|
|
417
|
+
>
|
|
418
|
+
<div
|
|
419
|
+
className={clsx(
|
|
420
|
+
"flex flex-row items-center justify-between",
|
|
421
|
+
typography.label,
|
|
422
|
+
"text-text-action-primary-normal",
|
|
423
|
+
)}
|
|
424
|
+
>
|
|
425
|
+
{idx === 0 ? (
|
|
426
|
+
<button
|
|
427
|
+
id={id ? `${id}-prev-month-button` : undefined}
|
|
428
|
+
data-testid={testid ? `${testid}-prev-month-button` : undefined}
|
|
429
|
+
type="button"
|
|
430
|
+
className={clsx(
|
|
431
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
432
|
+
componentPadding,
|
|
433
|
+
)}
|
|
434
|
+
aria-label="Previous month"
|
|
435
|
+
onClick={() => setBaseMonth(baseMonth.subtract({ months: 1 }))}
|
|
436
|
+
>
|
|
437
|
+
<Icon name="chevron_left" size={24} />
|
|
438
|
+
</button>
|
|
439
|
+
) : (
|
|
440
|
+
<span className={clsx(componentPadding, "mr-1")} />
|
|
441
|
+
)}
|
|
442
|
+
<div className="flex gap-desktop-compact-component-padding">
|
|
443
|
+
<button
|
|
444
|
+
ref={(el) => {
|
|
445
|
+
monthMenuRef.current = el;
|
|
446
|
+
}}
|
|
447
|
+
type="button"
|
|
448
|
+
onClick={() => {
|
|
449
|
+
setMonthMenuOpen(true);
|
|
450
|
+
setYearMenuOpen(false);
|
|
451
|
+
}}
|
|
452
|
+
className="font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate"
|
|
453
|
+
>
|
|
454
|
+
{month.name}
|
|
455
|
+
</button>
|
|
456
|
+
<Menu
|
|
457
|
+
show={monthMenuOpen}
|
|
458
|
+
positionTo={monthMenuRef}
|
|
459
|
+
setShow={() => setMonthMenuOpen(false)}
|
|
460
|
+
>
|
|
461
|
+
{months
|
|
462
|
+
.map((x) => [x, getMonthDataWith(x + 1)] as const)
|
|
463
|
+
.map(([x, m]) => (
|
|
464
|
+
<MenuOption
|
|
465
|
+
key={m.name}
|
|
466
|
+
selected={baseMonth.month === x + 1}
|
|
467
|
+
onClick={() => {
|
|
468
|
+
setBaseMonth(baseMonth.with({ month: x + 1 }));
|
|
469
|
+
setMonthMenuOpen(false);
|
|
470
|
+
}}
|
|
471
|
+
>
|
|
472
|
+
{m.name}
|
|
473
|
+
</MenuOption>
|
|
474
|
+
))}
|
|
475
|
+
</Menu>
|
|
476
|
+
<button
|
|
477
|
+
ref={(el) => {
|
|
478
|
+
yearMenuRef.current = el;
|
|
479
|
+
}}
|
|
480
|
+
type="button"
|
|
481
|
+
onClick={() => {
|
|
482
|
+
setYearMenuOpen(true);
|
|
483
|
+
setMonthMenuOpen(false);
|
|
484
|
+
}}
|
|
485
|
+
className="font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate"
|
|
486
|
+
>
|
|
487
|
+
{month.year}
|
|
488
|
+
</button>
|
|
489
|
+
<Menu
|
|
490
|
+
show={yearMenuOpen}
|
|
491
|
+
positionTo={yearMenuRef}
|
|
492
|
+
setShow={() => setYearMenuOpen(false)}
|
|
493
|
+
>
|
|
494
|
+
{years.map((y) => (
|
|
495
|
+
<MenuOption
|
|
496
|
+
key={y}
|
|
497
|
+
selected={baseMonth.year === y}
|
|
498
|
+
onClick={() => {
|
|
499
|
+
setBaseMonth(baseMonth.with({ year: y }));
|
|
500
|
+
setYearMenuOpen(false);
|
|
501
|
+
}}
|
|
502
|
+
>
|
|
503
|
+
{y}
|
|
504
|
+
</MenuOption>
|
|
505
|
+
))}
|
|
506
|
+
</Menu>
|
|
507
|
+
</div>
|
|
508
|
+
{(mode === "double" ? idx === 1 : true) ? (
|
|
509
|
+
<button
|
|
510
|
+
id={id ? `${id}-next-month-button` : undefined}
|
|
511
|
+
data-testid={testid ? `${testid}-next-month-button` : undefined}
|
|
512
|
+
type="button"
|
|
513
|
+
className={clsx(
|
|
514
|
+
"flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
|
|
515
|
+
componentPadding,
|
|
516
|
+
)}
|
|
517
|
+
aria-label="Next month"
|
|
518
|
+
onClick={() => setBaseMonth(baseMonth.add({ months: 1 }))}
|
|
519
|
+
>
|
|
520
|
+
<Icon name="chevron_right" size={24} />
|
|
521
|
+
</button>
|
|
522
|
+
) : (
|
|
523
|
+
<span className={clsx(componentPadding, "ml-1")} />
|
|
524
|
+
)}
|
|
525
|
+
</div>
|
|
526
|
+
<div className={clsx("grid grid-cols-7")}>
|
|
527
|
+
{weekDays.map((d) => (
|
|
528
|
+
<span
|
|
529
|
+
key={d}
|
|
530
|
+
className={clsx(
|
|
531
|
+
typography.caption,
|
|
532
|
+
"text-text-secondary-normal text-center",
|
|
533
|
+
"w-10",
|
|
534
|
+
)}
|
|
535
|
+
>
|
|
536
|
+
{d}
|
|
537
|
+
</span>
|
|
538
|
+
))}
|
|
539
|
+
</div>
|
|
540
|
+
<div className={clsx("grid grid-cols-7")}>
|
|
541
|
+
{Array.from({ length: totalCells }).map((_, i) => {
|
|
542
|
+
const day = i - emptyCells + 1;
|
|
543
|
+
const date = month.date.with({ day: 1 }).add({
|
|
544
|
+
days: i - emptyCells,
|
|
545
|
+
});
|
|
546
|
+
const isInMonth = day > 0 && day <= month.days;
|
|
547
|
+
const isToday = isInMonth && date.equals(today);
|
|
548
|
+
const isSelected =
|
|
549
|
+
isInMonth &&
|
|
550
|
+
((!pendingFrom && fromDate && date.equals(fromDate)) ||
|
|
551
|
+
(!pendingFrom && toDate && date.equals(toDate)) ||
|
|
552
|
+
(pendingFrom && date.equals(pendingFrom)));
|
|
553
|
+
const inRange = isInMonth && isInRange(date);
|
|
554
|
+
const isDisabled =
|
|
555
|
+
!isInMonth || (isDateAvailable ? !isDateAvailable(date) : false);
|
|
556
|
+
// New: determine if this is the start or end of the range
|
|
403
557
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
558
|
+
const hoverDateIsBeforePendingFrom =
|
|
559
|
+
hoveredDate &&
|
|
560
|
+
pendingFrom &&
|
|
561
|
+
Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0;
|
|
408
562
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
isInMonth &&
|
|
414
|
-
fromDate &&
|
|
415
|
-
date.equals(fromDate)) ||
|
|
416
|
-
(hoverDateIsAfterPendingFrom &&
|
|
417
|
-
date.equals(pendingFrom));
|
|
563
|
+
const hoverDateIsAfterPendingFrom =
|
|
564
|
+
hoveredDate &&
|
|
565
|
+
pendingFrom &&
|
|
566
|
+
Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
|
|
418
567
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
date.equals(pendingFrom));
|
|
428
|
-
return (
|
|
429
|
-
<DateCell
|
|
430
|
-
key={i}
|
|
431
|
-
id={id ? `${id}-date-${date.toString()}` : undefined}
|
|
432
|
-
testid={
|
|
433
|
-
testid
|
|
434
|
-
? `${testid}-date-${date.toString()}`
|
|
435
|
-
: undefined
|
|
436
|
-
}
|
|
437
|
-
date={date}
|
|
438
|
-
isInMonth={!!isInMonth}
|
|
439
|
-
isToday={!!isToday}
|
|
440
|
-
isSelected={!!isSelected}
|
|
441
|
-
inRange={!!inRange}
|
|
442
|
-
isDisabled={!!isDisabled}
|
|
443
|
-
onClick={() => handleDayClick(date)}
|
|
444
|
-
onMouseEnter={() => setHoveredDate(date)}
|
|
445
|
-
onMouseLeave={() => setHoveredDate(undefined)}
|
|
446
|
-
isRangeStart={!!isRangeStart}
|
|
447
|
-
isRangeEnd={!!isRangeEnd}
|
|
448
|
-
isRangeDisabled={mode === "single" && disableRange}
|
|
449
|
-
// Add cell padding for spacing
|
|
450
|
-
cellPadding={componentPadding}
|
|
451
|
-
/>
|
|
452
|
-
);
|
|
453
|
-
})}
|
|
454
|
-
</div>
|
|
455
|
-
</div>
|
|
456
|
-
{mode === "double" && idx === 0 && (
|
|
457
|
-
<div
|
|
458
|
-
className={clsx(
|
|
459
|
-
"self-stretch bg-border-primary-normal rounded-base",
|
|
568
|
+
const isRangeStart =
|
|
569
|
+
mode === "single" && disableRange
|
|
570
|
+
? false
|
|
571
|
+
: (!pendingFrom &&
|
|
572
|
+
isInMonth &&
|
|
573
|
+
fromDate &&
|
|
574
|
+
date.equals(fromDate)) ||
|
|
575
|
+
(hoverDateIsAfterPendingFrom && date.equals(pendingFrom));
|
|
460
576
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
577
|
+
const isRangeEnd =
|
|
578
|
+
mode === "single" && disableRange
|
|
579
|
+
? false
|
|
580
|
+
: (!pendingFrom &&
|
|
581
|
+
isInMonth &&
|
|
582
|
+
toDate &&
|
|
583
|
+
date.equals(toDate)) ||
|
|
584
|
+
(hoverDateIsBeforePendingFrom && date.equals(pendingFrom));
|
|
585
|
+
return (
|
|
586
|
+
<DateCell
|
|
587
|
+
key={i}
|
|
588
|
+
id={id ? `${id}-date-${date.toString()}` : undefined}
|
|
589
|
+
testid={
|
|
590
|
+
testid ? `${testid}-date-${date.toString()}` : undefined
|
|
591
|
+
}
|
|
592
|
+
date={date}
|
|
593
|
+
isInMonth={!!isInMonth}
|
|
594
|
+
isToday={!!isToday}
|
|
595
|
+
isSelected={!!isSelected}
|
|
596
|
+
inRange={!!inRange}
|
|
597
|
+
isDisabled={!!isDisabled}
|
|
598
|
+
onClick={() => handleDayClick(date)}
|
|
599
|
+
onMouseEnter={() => setHoveredDate(date)}
|
|
600
|
+
onMouseLeave={() => setHoveredDate(undefined)}
|
|
601
|
+
isRangeStart={!!isRangeStart}
|
|
602
|
+
isRangeEnd={!!isRangeEnd}
|
|
603
|
+
isRangeDisabled={mode === "single" && disableRange}
|
|
604
|
+
// Add cell padding for spacing
|
|
605
|
+
cellPadding={componentPadding}
|
|
606
|
+
/>
|
|
607
|
+
);
|
|
608
|
+
})}
|
|
609
|
+
</div>
|
|
469
610
|
</div>
|
|
470
|
-
|
|
611
|
+
{mode === "double" && idx === 0 && (
|
|
612
|
+
<div
|
|
613
|
+
className={clsx(
|
|
614
|
+
"self-stretch bg-border-primary-normal rounded-base",
|
|
615
|
+
|
|
616
|
+
// 1px width, full height, matches Figma divider
|
|
617
|
+
"w-px",
|
|
618
|
+
)}
|
|
619
|
+
/>
|
|
620
|
+
)}
|
|
621
|
+
</React.Fragment>
|
|
471
622
|
);
|
|
472
623
|
}
|
|
473
624
|
|
package/src/components/Input.tsx
CHANGED
|
@@ -56,6 +56,7 @@ export type InputBaseProps = {
|
|
|
56
56
|
removeBorder?: boolean;
|
|
57
57
|
wrapperClassName?: string;
|
|
58
58
|
focus?: boolean;
|
|
59
|
+
secondaryIconColor?: boolean;
|
|
59
60
|
fullWidth?: boolean; // If true, input takes full width of the container
|
|
60
61
|
} & InputFormatting &
|
|
61
62
|
Omit<ComponentProps<"input">, "align" | "id">;
|
|
@@ -78,6 +79,7 @@ export const InputBase = ({
|
|
|
78
79
|
removeBorder,
|
|
79
80
|
wrapperClassName,
|
|
80
81
|
focus,
|
|
82
|
+
secondaryIconColor,
|
|
81
83
|
fullWidth = true,
|
|
82
84
|
...props
|
|
83
85
|
}: InputBaseProps) => {
|
|
@@ -151,6 +153,7 @@ export const InputBase = ({
|
|
|
151
153
|
<div className={clsx("flex items-center", componentGap)}>
|
|
152
154
|
<Label
|
|
153
155
|
id={id ? `${id}-label` : undefined}
|
|
156
|
+
color={error ? "text-primary-error" : undefined}
|
|
154
157
|
className={clsx(
|
|
155
158
|
props.disabled || props.readOnly
|
|
156
159
|
? "cursor-default"
|
|
@@ -205,10 +208,21 @@ export const InputBase = ({
|
|
|
205
208
|
)}
|
|
206
209
|
/>
|
|
207
210
|
|
|
208
|
-
{
|
|
211
|
+
{secondaryIconColor ? (
|
|
212
|
+
<span className="contents text-text-secondary-normal">{after}</span>
|
|
213
|
+
) : (
|
|
214
|
+
after
|
|
215
|
+
)}
|
|
209
216
|
</div>
|
|
210
217
|
|
|
211
|
-
{caption &&
|
|
218
|
+
{caption && (
|
|
219
|
+
<div
|
|
220
|
+
id={id ? `${id}-caption` : undefined}
|
|
221
|
+
data-testid={testid ? `${testid}-caption` : undefined}
|
|
222
|
+
>
|
|
223
|
+
{caption}
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
212
226
|
</label>
|
|
213
227
|
);
|
|
214
228
|
};
|
|
@@ -225,7 +239,7 @@ export const Input = ({
|
|
|
225
239
|
id,
|
|
226
240
|
testid,
|
|
227
241
|
...props
|
|
228
|
-
}: Omit<ComponentProps<"input">,"onChange" | "align" | "children"> &
|
|
242
|
+
}: Omit<ComponentProps<"input">, "onChange" | "align" | "children"> &
|
|
229
243
|
InputBaseProps & {
|
|
230
244
|
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
231
245
|
onClear?: () => void;
|
|
@@ -240,7 +254,7 @@ export const Input = ({
|
|
|
240
254
|
}, [propValue]);
|
|
241
255
|
|
|
242
256
|
useEffect(() => {
|
|
243
|
-
if (variant !==
|
|
257
|
+
if (variant !== "currency") {
|
|
244
258
|
return;
|
|
245
259
|
}
|
|
246
260
|
|
|
@@ -254,7 +268,7 @@ export const Input = ({
|
|
|
254
268
|
|
|
255
269
|
setInternalValue(formatted);
|
|
256
270
|
setDisplayValue(formatCurrencyDisplay(formatted));
|
|
257
|
-
}, [])
|
|
271
|
+
}, []);
|
|
258
272
|
|
|
259
273
|
const getInputProps = () => {
|
|
260
274
|
const baseProps = {
|