@giro-ds/react 11.2.0 → 12.0.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.
- package/dist/index.cjs +397 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +211 -80
- package/dist/index.esm.js +398 -125
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +4 -4
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -33,12 +33,13 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
33
33
|
|
|
34
34
|
var styles$v = {"AvatarRoot":"Avatar-module__AvatarRoot___7eNx7","AvatarRoot--sm":"Avatar-module__AvatarRoot--sm___LVHoe","AvatarRoot--lg":"Avatar-module__AvatarRoot--lg___QWux5","AvatarImage":"Avatar-module__AvatarImage___-H6iH","AvatarFallback":"Avatar-module__AvatarFallback___RDyNV"};
|
|
35
35
|
|
|
36
|
-
const Avatar = ({ icon, size = 'lg', src, className,
|
|
36
|
+
const Avatar = ({ icon, size = 'lg', src, className, text, ...rest }) => {
|
|
37
37
|
const AvatarClass = clsx(styles$v.AvatarRoot, {
|
|
38
38
|
[styles$v['AvatarRoot--lg']]: size === 'lg',
|
|
39
39
|
[styles$v['AvatarRoot--sm']]: size === 'sm',
|
|
40
40
|
}, className);
|
|
41
|
-
|
|
41
|
+
const truncatedText = text ? text.slice(0, 2) : undefined;
|
|
42
|
+
return (jsxRuntime.jsxs(radixUi.Avatar.Root, { className: AvatarClass, ...rest, children: [src && (jsxRuntime.jsx(radixUi.Avatar.Image, { className: styles$v.AvatarImage, src: src, alt: "Avatar" })), jsxRuntime.jsx(radixUi.Avatar.Fallback, { className: styles$v.AvatarFallback, children: icon || truncatedText })] }));
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
var styles$u = {"badge__status":"Badge-module__badge__status___-u3xv","badge":"Badge-module__badge___ZbEBU","badgeContainer":"Badge-module__badgeContainer___Guw9Z","badge__empty":"Badge-module__badge__empty___u8ccy","badge__flex":"Badge-module__badge__flex___DSJHW","badge__status__empty":"Badge-module__badge__status__empty___h8L4e","badge__status__flex":"Badge-module__badge__status__flex___703Q6","badge__status__filterBadge":"Badge-module__badge__status__filterBadge___DhjGU"};
|
|
@@ -83,7 +84,7 @@ const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, s
|
|
|
83
84
|
|
|
84
85
|
var styles$s = {"button":"Button-module__button___18Bed","button-lg":"Button-module__button-lg___-A8B9","button-sm":"Button-module__button-sm___L7aT7","button-filled":"Button-module__button-filled___IQx1z","button-outlined":"Button-module__button-outlined___hLkLN","button-text":"Button-module__button-text___8GFeA","buttonWithIcon":"Button-module__buttonWithIcon___8ehK1","buttonIconPosition-left":"Button-module__buttonIconPosition-left___uOY6b","buttonIconPosition-right":"Button-module__buttonIconPosition-right___eswRS","buttonIconPosition-both":"Button-module__buttonIconPosition-both___1Lith","buttonNoContent":"Button-module__buttonNoContent___Tc9jk","buttonIconOnly":"Button-module__buttonIconOnly___aifk4","buttonIconLeft":"Button-module__buttonIconLeft___RICR3","buttonIconRight":"Button-module__buttonIconRight___71lu2","buttonFullWidth":"Button-module__buttonFullWidth___tXuVE","disabled":"Button-module__disabled___UzdWL","buttonLoading":"Button-module__buttonLoading___RGdNw","buttonContentHidden":"Button-module__buttonContentHidden___CoCiN","buttonLoadingSpinner":"Button-module__buttonLoadingSpinner___oZxEU","spin":"Button-module__spin___kQKH9"};
|
|
85
86
|
|
|
86
|
-
const Button =
|
|
87
|
+
const Button = ({ ref, as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', scale = 1, className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...rest }) => {
|
|
87
88
|
const generatedId = React.useId();
|
|
88
89
|
const componentId = id || generatedId;
|
|
89
90
|
const getComponent = () => {
|
|
@@ -199,7 +200,7 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
199
200
|
return (jsxRuntime.jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: jsxRuntime.jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }) }));
|
|
200
201
|
}
|
|
201
202
|
return (jsxRuntime.jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }));
|
|
202
|
-
}
|
|
203
|
+
};
|
|
203
204
|
Button.displayName = 'Button';
|
|
204
205
|
|
|
205
206
|
function buildFormatLongFn(args) {
|
|
@@ -1376,30 +1377,42 @@ const offsetFormatCache = {};
|
|
|
1376
1377
|
const offsetCache = {};
|
|
1377
1378
|
|
|
1378
1379
|
/**
|
|
1379
|
-
* The function
|
|
1380
|
+
* The function returns UTC offset in minutes for the given date in specified
|
|
1380
1381
|
* time zone.
|
|
1381
1382
|
*
|
|
1382
1383
|
* Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
|
|
1383
1384
|
* mirrored to the sign of the offset in the time zone. For Asia/Singapore
|
|
1384
|
-
* (UTC+8), `tzOffset` returns 480
|
|
1385
|
+
* (UTC+8), `tzOffset` returns `480`, while `getTimezoneOffset` returns `-480`.
|
|
1385
1386
|
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1387
|
+
* It uses `Intl.DateTimeFormat` internally to access otherwise unavailable
|
|
1388
|
+
* runtime's time zone data, and falls back to basic manual parsing if Intl API
|
|
1389
|
+
* is not supported (e.g., older Node.js versions, React Native's Hermes, etc.).
|
|
1388
1390
|
*
|
|
1389
|
-
* @
|
|
1391
|
+
* @param timeZone - Time zone name (IANA or UTC offset).
|
|
1392
|
+
* @param date - Date to check the offset for.
|
|
1393
|
+
*
|
|
1394
|
+
* @returns UTC offset in minutes (e.g., `480` for date in UTC+8).
|
|
1390
1395
|
*/
|
|
1391
1396
|
function tzOffset(timeZone, date) {
|
|
1392
1397
|
try {
|
|
1398
|
+
// Create `Intl.DateTimeFormat` with `"longOffset"` that gives us consistent
|
|
1399
|
+
// date strings like `"5/19/2026, GMT-08:00"`.
|
|
1393
1400
|
const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
|
|
1394
1401
|
timeZone,
|
|
1395
1402
|
timeZoneName: "longOffset"
|
|
1396
1403
|
}).format;
|
|
1404
|
+
|
|
1405
|
+
// Get `"-08:00"`.
|
|
1397
1406
|
const offsetStr = format(date).split("GMT")[1];
|
|
1407
|
+
|
|
1408
|
+
// Avoid parsing the same offset string.
|
|
1398
1409
|
if (offsetStr in offsetCache) return offsetCache[offsetStr];
|
|
1410
|
+
|
|
1411
|
+
// Calculate offset from `["-08", "00"]` and cache it.
|
|
1399
1412
|
return calcOffset(offsetStr, offsetStr.split(":"));
|
|
1400
1413
|
} catch {
|
|
1401
|
-
// Fallback to manual parsing if the runtime doesn't support
|
|
1402
|
-
// See: https://github.com/nodejs/node/issues/53419
|
|
1414
|
+
// Fallback to manual parsing if the runtime doesn't support
|
|
1415
|
+
// `±HH:MM/±HHMM/±HH`. See: https://github.com/nodejs/node/issues/53419.
|
|
1403
1416
|
if (timeZone in offsetCache) return offsetCache[timeZone];
|
|
1404
1417
|
const captures = timeZone?.match(offsetRe);
|
|
1405
1418
|
if (captures) return calcOffset(timeZone, captures.slice(1));
|
|
@@ -1415,30 +1428,69 @@ function calcOffset(cacheStr, values) {
|
|
|
1415
1428
|
return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
|
|
1416
1429
|
}
|
|
1417
1430
|
|
|
1431
|
+
// TZDate stores time in two `Date` objects because native `Date` can only
|
|
1432
|
+
// expose local fields in the system time zone.
|
|
1433
|
+
//
|
|
1434
|
+
// The external date (`this`) stores the real timestamp. It is the value used by
|
|
1435
|
+
// `getTime()`, `valueOf()`, UTC getters/setters, comparisons, and arithmetic.
|
|
1436
|
+
// Its local getters are not used for target-zone fields because they would read
|
|
1437
|
+
// the timestamp through the system time zone.
|
|
1438
|
+
//
|
|
1439
|
+
// The internal date (`this.internal`) stores the target-zone wall-clock fields.
|
|
1440
|
+
// We read and write those fields through UTC getters/setters so the host system
|
|
1441
|
+
// time zone cannot reinterpret them. For example, `getHours()` returns
|
|
1442
|
+
// `internal.getUTCHours()`, and `setHours()` writes `internal.setUTCHours(...)`.
|
|
1443
|
+
//
|
|
1444
|
+
// Syncing moves data between the two representations:
|
|
1445
|
+
//
|
|
1446
|
+
// - `syncToInternal` starts from the external timestamp and rebuilds internal
|
|
1447
|
+
// wall-clock fields using `this.timeZone` offset.
|
|
1448
|
+
//
|
|
1449
|
+
// - `syncFromInternal` starts from internal wall-clock fields, writes them into
|
|
1450
|
+
// the external date, then adjusts that timestamp for the system/target offset
|
|
1451
|
+
// difference and DST edge cases.
|
|
1452
|
+
//
|
|
1453
|
+
// The public TZDate value is the combination of both: external is the instant,
|
|
1454
|
+
// internal is the wall-clock view of that instant in `this.timeZone`.
|
|
1455
|
+
|
|
1418
1456
|
class TZDateMini extends Date {
|
|
1419
1457
|
//#region static
|
|
1420
1458
|
|
|
1421
1459
|
constructor(...args) {
|
|
1422
1460
|
super();
|
|
1461
|
+
|
|
1462
|
+
// Time zone string is always the last string argument unless date string
|
|
1463
|
+
// is passed (as a single argument).
|
|
1423
1464
|
if (args.length > 1 && typeof args[args.length - 1] === "string") {
|
|
1424
1465
|
this.timeZone = args.pop();
|
|
1425
1466
|
}
|
|
1426
1467
|
this.internal = new Date();
|
|
1468
|
+
|
|
1469
|
+
// Validate the time zone by checking its offset.
|
|
1427
1470
|
if (isNaN(tzOffset(this.timeZone, this))) {
|
|
1428
1471
|
this.setTime(NaN);
|
|
1429
1472
|
} else {
|
|
1430
1473
|
if (!args.length) {
|
|
1474
|
+
// No arguments passed: use current time
|
|
1431
1475
|
this.setTime(Date.now());
|
|
1432
1476
|
} else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
|
|
1477
|
+
// Timestamp passed: use it as is
|
|
1433
1478
|
this.setTime(args[0]);
|
|
1434
1479
|
} else if (typeof args[0] === "string") {
|
|
1480
|
+
// `Date` string passed: parse it as external date
|
|
1435
1481
|
this.setTime(+new Date(args[0]));
|
|
1436
1482
|
} else if (args[0] instanceof Date) {
|
|
1483
|
+
// `Date` passed: use its timestamp
|
|
1437
1484
|
this.setTime(+args[0]);
|
|
1438
1485
|
} else {
|
|
1486
|
+
// `Date` values passed:
|
|
1487
|
+
|
|
1488
|
+
// Set it as external date.
|
|
1439
1489
|
this.setTime(+new Date(...args));
|
|
1440
|
-
|
|
1441
|
-
|
|
1490
|
+
|
|
1491
|
+
// Adjust internal and external dates considering that we might have
|
|
1492
|
+
// landed on the DST hour.
|
|
1493
|
+
adjustToSystemTZ(this, args);
|
|
1442
1494
|
}
|
|
1443
1495
|
}
|
|
1444
1496
|
}
|
|
@@ -1455,8 +1507,8 @@ class TZDateMini extends Date {
|
|
|
1455
1507
|
}
|
|
1456
1508
|
getTimezoneOffset() {
|
|
1457
1509
|
const offset = -tzOffset(this.timeZone, this);
|
|
1458
|
-
// Remove the seconds offset
|
|
1459
|
-
//
|
|
1510
|
+
// Remove the seconds offset using `Math.floor` for negative UTC time zones
|
|
1511
|
+
// and `Math.ceil` for positive UTC time zones.
|
|
1460
1512
|
return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
|
|
1461
1513
|
}
|
|
1462
1514
|
|
|
@@ -1464,8 +1516,11 @@ class TZDateMini extends Date {
|
|
|
1464
1516
|
|
|
1465
1517
|
//#region time
|
|
1466
1518
|
|
|
1467
|
-
setTime(
|
|
1519
|
+
setTime(_time) {
|
|
1520
|
+
// Use the native `setTime` to the external date time.
|
|
1468
1521
|
Date.prototype.setTime.apply(this, arguments);
|
|
1522
|
+
|
|
1523
|
+
// Then apply it to the internal date adjusting to the timezone offset.
|
|
1469
1524
|
syncToInternal(this);
|
|
1470
1525
|
return +this;
|
|
1471
1526
|
}
|
|
@@ -1511,23 +1566,40 @@ Object.getOwnPropertyNames(Date.prototype).forEach(method => {
|
|
|
1511
1566
|
});
|
|
1512
1567
|
|
|
1513
1568
|
/**
|
|
1514
|
-
*
|
|
1569
|
+
* @internal
|
|
1570
|
+
* Function syncs time to internal date, applying the current time zone offset.
|
|
1515
1571
|
*
|
|
1516
|
-
* @param {Date} date - Date to sync
|
|
1572
|
+
* @param {Date} date - `Date` to sync
|
|
1517
1573
|
*/
|
|
1518
1574
|
function syncToInternal(date) {
|
|
1575
|
+
// Start internal from the same real timestamp as external.
|
|
1519
1576
|
date.internal.setTime(+date);
|
|
1520
|
-
|
|
1577
|
+
|
|
1578
|
+
// Shift internal by the target offset so its UTC fields become the target-zone
|
|
1579
|
+
// wall-clock fields for the external timestamp.
|
|
1580
|
+
//
|
|
1581
|
+
// o internal UTC fields: 2024-02-11 00:00
|
|
1582
|
+
// |
|
|
1583
|
+
// | + Asia/Singapore offset (+08:00)
|
|
1584
|
+
// v
|
|
1585
|
+
// x internal UTC fields: 2024-02-11 08:00
|
|
1586
|
+
//
|
|
1587
|
+
date.internal.setUTCSeconds(date.internal.getUTCSeconds() -
|
|
1588
|
+
// Round after converting minutes to seconds to avoid fractional offset
|
|
1589
|
+
// precision errors from historical offsets.
|
|
1590
|
+
Math.round(-tzOffset(date.timeZone, date) * 60));
|
|
1521
1591
|
}
|
|
1522
1592
|
|
|
1523
1593
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1594
|
+
* @internal
|
|
1595
|
+
* Function syncs internal wall-clock fields into the external date.
|
|
1526
1596
|
*
|
|
1527
1597
|
* @param {Date} date - The date to sync
|
|
1528
1598
|
*/
|
|
1529
1599
|
function syncFromInternal(date) {
|
|
1530
|
-
//
|
|
1600
|
+
// Copy target-zone wall-clock fields from internal into external using native
|
|
1601
|
+
// local setters. At this point external holds the right field values but they
|
|
1602
|
+
// are interpreted in the system time zone; `adjustToSystemTZ` fixes that.
|
|
1531
1603
|
Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
|
|
1532
1604
|
Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
|
|
1533
1605
|
|
|
@@ -1536,115 +1608,271 @@ function syncFromInternal(date) {
|
|
|
1536
1608
|
}
|
|
1537
1609
|
|
|
1538
1610
|
/**
|
|
1611
|
+
* @internal
|
|
1539
1612
|
* Function adjusts the date to the system time zone. It uses the time zone
|
|
1540
1613
|
* differences to calculate the offset and adjust the date.
|
|
1541
1614
|
*
|
|
1542
|
-
*
|
|
1615
|
+
* We use it when constructing `TZDate` and syncing the external date from
|
|
1616
|
+
* the internal one.
|
|
1617
|
+
*
|
|
1618
|
+
* @param {TZDate} date - `TZDate` to adjust.
|
|
1543
1619
|
*/
|
|
1544
|
-
function adjustToSystemTZ(date) {
|
|
1545
|
-
//
|
|
1546
|
-
|
|
1547
|
-
//
|
|
1548
|
-
|
|
1549
|
-
|
|
1620
|
+
function adjustToSystemTZ(date, constructorArgs) {
|
|
1621
|
+
// Keep the intended target-zone wall-clock value before native Date/system
|
|
1622
|
+
// time zone normalization can move it. Later corrections compare against this
|
|
1623
|
+
// value to distinguish intended DST normalization from accidental drift.
|
|
1624
|
+
const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal;
|
|
1625
|
+
//#region Initial offset calculation
|
|
1626
|
+
|
|
1627
|
+
// Current target time zone offset at the native timestamp. It may include
|
|
1628
|
+
// historical offset seconds, which we preserve for the seconds adjustment.
|
|
1629
|
+
const offsetWithSeconds = tzOffset(date.timeZone, date);
|
|
1630
|
+
|
|
1631
|
+
// Minute-precision target offset used by minute-based timestamp adjustments.
|
|
1632
|
+
// Historical offsets can contain seconds, so we strip the fractional minute
|
|
1633
|
+
// here and handle remaining seconds in the seconds adjustment below.
|
|
1634
|
+
const offset = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds);
|
|
1635
|
+
|
|
1636
|
+
//#endregion
|
|
1637
|
+
|
|
1550
1638
|
//#region System DST adjustment
|
|
1551
1639
|
|
|
1552
|
-
//
|
|
1553
|
-
//
|
|
1554
|
-
// up on the DST hour:
|
|
1555
|
-
//
|
|
1556
|
-
// $ TZ=America/New_York node
|
|
1557
|
-
// > new Date(2020, 2, 8, 1).toString()
|
|
1558
|
-
// 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'
|
|
1559
|
-
// > new Date(2020, 2, 8, 2).toString()
|
|
1560
|
-
// 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
1561
|
-
// > new Date(2020, 2, 8, 3).toString()
|
|
1562
|
-
// 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
1563
|
-
// > new Date(2020, 2, 8, 4).toString()
|
|
1564
|
-
// 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
1565
|
-
//
|
|
1566
|
-
// Here we get the same hour for both 2 and 3, because the system time zone
|
|
1567
|
-
// has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have
|
|
1568
|
-
// to adjust the internal date to reflect that.
|
|
1640
|
+
// Native `Date` may normalize the requested wall time when the system time
|
|
1641
|
+
// zone skips that hour for DST.
|
|
1569
1642
|
//
|
|
1570
|
-
//
|
|
1571
|
-
//
|
|
1643
|
+
// We compare the system wall-clock hour represented by the external date with
|
|
1644
|
+
// the wall-clock hour stored in the internal date. If they differ, the next
|
|
1645
|
+
// offset-diff calculation may need the previous system offset, because the
|
|
1646
|
+
// current external timestamp is already after the system DST jump.
|
|
1572
1647
|
|
|
1573
|
-
//
|
|
1574
|
-
//
|
|
1648
|
+
// Previous-hour reference used to detect whether the system offset changed
|
|
1649
|
+
// immediately before the current native timestamp.
|
|
1575
1650
|
const prevHour = new Date(+date);
|
|
1576
|
-
|
|
1577
|
-
//
|
|
1651
|
+
|
|
1652
|
+
// Use UTC math so subtracting one hour cannot be normalized back into the
|
|
1653
|
+
// same missing local DST hour.
|
|
1578
1654
|
prevHour.setUTCHours(prevHour.getUTCHours() - 1);
|
|
1579
1655
|
|
|
1580
|
-
//
|
|
1656
|
+
// Current system offset at the native timestamp.
|
|
1581
1657
|
const systemOffset = -new Date(+date).getTimezoneOffset();
|
|
1658
|
+
|
|
1659
|
+
// System offset one real hour before the native timestamp.
|
|
1582
1660
|
const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
|
|
1661
|
+
|
|
1662
|
+
// Non-zero when the system offset changed between `prevHour` and `date`.
|
|
1583
1663
|
const systemDSTChange = systemOffset - prevHourSystemOffset;
|
|
1584
|
-
// Detect the DST shift. System DST change will occur both on
|
|
1585
|
-
const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
|
|
1586
1664
|
|
|
1587
|
-
//
|
|
1588
|
-
|
|
1665
|
+
// System offset to use in the later system-target offset difference.
|
|
1666
|
+
// Defaults to the current system offset and switches to the previous offset
|
|
1667
|
+
// only when native `Date` normalized a missing system wall time.
|
|
1668
|
+
let systemOffsetForDiff = systemOffset;
|
|
1669
|
+
if (systemDSTChange && systemOffset !== offset) {
|
|
1670
|
+
// System wall-clock hour represented by the current external timestamp.
|
|
1671
|
+
const systemHour = Date.prototype.getHours.apply(date);
|
|
1672
|
+
|
|
1673
|
+
// Target wall-clock hour currently stored in internal fields. Constructors
|
|
1674
|
+
// get it from arguments because internal may have already been synced from
|
|
1675
|
+
// the normalized external timestamp; setters get it directly from internal.
|
|
1676
|
+
const expectedHour = Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours();
|
|
1677
|
+
if (systemHour !== expectedHour) {
|
|
1678
|
+
// Check whether using the current system offset would keep the target
|
|
1679
|
+
// offset unchanged. If so, the only DST jump we crossed is the system
|
|
1680
|
+
// one, so the diff should use the pre-DST system offset.
|
|
1681
|
+
const testDate = new Date(+date);
|
|
1682
|
+
|
|
1683
|
+
// Difference that the later offset-diff step would apply with the
|
|
1684
|
+
// current system offset.
|
|
1685
|
+
const testOffsetDiff = systemOffset - offset;
|
|
1686
|
+
if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff);
|
|
1687
|
+
|
|
1688
|
+
// Target offset after applying the current system offset difference.
|
|
1689
|
+
const testOffsetWithSeconds = tzOffset(date.timeZone, testDate);
|
|
1690
|
+
|
|
1691
|
+
// Target offset without historical seconds, matching `offset`.
|
|
1692
|
+
const testOffset = testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds);
|
|
1693
|
+
if (testOffset === offset) systemOffsetForDiff = prevHourSystemOffset;
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1589
1696
|
|
|
1590
1697
|
//#endregion
|
|
1591
1698
|
|
|
1592
1699
|
//#region System diff adjustment
|
|
1593
1700
|
|
|
1594
|
-
//
|
|
1595
|
-
//
|
|
1596
|
-
//
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1701
|
+
// Move external from the system-zone interpretation of internal fields toward
|
|
1702
|
+
// the timestamp that represents those fields in the target time zone.
|
|
1703
|
+
//
|
|
1704
|
+
// At this point native `Date` has treated the internal wall-clock fields as if
|
|
1705
|
+
// they belonged to the system zone. The system-target offset difference moves
|
|
1706
|
+
// external by the distance between that system interpretation and the target
|
|
1707
|
+
// interpretation.
|
|
1708
|
+
|
|
1709
|
+
// Difference between the system offset selected above and the minute-precision
|
|
1710
|
+
// target offset. Positive values move external forward; negative values move
|
|
1711
|
+
// it backward.
|
|
1712
|
+
const offsetDiff = systemOffsetForDiff - offset;
|
|
1713
|
+
if (offsetDiff)
|
|
1714
|
+
// Apply the system-target minute difference to external. Internal is
|
|
1715
|
+
// rebuilt from the final external timestamp after all adjustments are
|
|
1716
|
+
// complete.
|
|
1717
|
+
//
|
|
1718
|
+
// o external as target: 2023-01-31 23:00
|
|
1719
|
+
// |
|
|
1720
|
+
// | add `offsetDiff`
|
|
1721
|
+
// v
|
|
1722
|
+
// x external as target: 2023-02-01 12:00
|
|
1723
|
+
//
|
|
1724
|
+
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
|
|
1600
1725
|
|
|
1601
1726
|
//#endregion
|
|
1602
1727
|
|
|
1603
|
-
//#region Seconds
|
|
1728
|
+
//#region Seconds system diff adjustment
|
|
1604
1729
|
|
|
1730
|
+
// Historical time zone offsets can include seconds, but the minute-based
|
|
1731
|
+
// offset adjustment above intentionally used minute precision.
|
|
1732
|
+
//
|
|
1733
|
+
// This adjustment applies the remaining seconds difference to external. For
|
|
1734
|
+
// example, historical Singapore used UTC+06:55:25, while ISO formatting shows
|
|
1735
|
+
// only `+06:55`; without the seconds correction, setter paths keep the wrong
|
|
1736
|
+
// wall-clock seconds.
|
|
1737
|
+
|
|
1738
|
+
// Clone external as a native `Date` so we can inspect how the system time zone
|
|
1739
|
+
// represents the same timestamp.
|
|
1605
1740
|
const systemDate = new Date(+date);
|
|
1606
|
-
|
|
1741
|
+
|
|
1742
|
+
// Zero UTC seconds before reading system seconds. Any remaining local seconds
|
|
1743
|
+
// then come from the system time zone offset rather than from the timestamp's
|
|
1744
|
+
// own seconds value.
|
|
1607
1745
|
systemDate.setUTCSeconds(0);
|
|
1608
|
-
|
|
1746
|
+
|
|
1747
|
+
// Seconds part contributed by the system time zone offset. Negative offsets
|
|
1748
|
+
// need wrapping because `Date#getSeconds()` returns values in the 0..59 range.
|
|
1609
1749
|
const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
|
|
1610
1750
|
|
|
1611
|
-
//
|
|
1751
|
+
// Seconds part contributed by the target time zone offset.
|
|
1612
1752
|
const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
|
|
1613
|
-
if (secondsOffset || systemSecondsOffset)
|
|
1614
|
-
|
|
1753
|
+
if (secondsOffset || systemSecondsOffset)
|
|
1754
|
+
// Apply the remaining second-level system-target difference to external.
|
|
1755
|
+
//
|
|
1756
|
+
// o external as Asia/Singapore: 1900-01-01 00:00:56
|
|
1757
|
+
// |
|
|
1758
|
+
// | + `secondsOffset`
|
|
1759
|
+
// | + `systemSecondsOffset`
|
|
1760
|
+
// v
|
|
1761
|
+
// x external as Asia/Singapore: 1900-01-01 00:00:31
|
|
1762
|
+
//
|
|
1615
1763
|
Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
|
|
1616
|
-
}
|
|
1617
1764
|
|
|
1618
1765
|
//#endregion
|
|
1619
1766
|
|
|
1620
1767
|
//#region Post-adjustment DST fix
|
|
1621
1768
|
|
|
1622
|
-
|
|
1623
|
-
//
|
|
1624
|
-
//
|
|
1625
|
-
|
|
1769
|
+
// The first system-target offset move can cross a target-zone DST boundary.
|
|
1770
|
+
//
|
|
1771
|
+
// When that happens, the target offset at the new external timestamp differs
|
|
1772
|
+
// from the target offset used for `offsetDiff`. We compare the original move
|
|
1773
|
+
// with the move that would be calculated at the new timestamp, then apply the
|
|
1774
|
+
// difference to external.
|
|
1775
|
+
|
|
1776
|
+
// Target offset at the current external timestamp, including historical
|
|
1777
|
+
// seconds for the later seconds adjustment.
|
|
1778
|
+
const postOffsetWithSeconds = tzOffset(date.timeZone, date);
|
|
1779
|
+
|
|
1780
|
+
// Minute-precision target offset at the current external timestamp.
|
|
1781
|
+
const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds);
|
|
1782
|
+
|
|
1783
|
+
// System offset at the current external timestamp.
|
|
1626
1784
|
const postSystemOffset = -new Date(+date).getTimezoneOffset();
|
|
1785
|
+
|
|
1786
|
+
// System-target offset difference at the current external timestamp.
|
|
1627
1787
|
const postOffsetDiff = postSystemOffset - postOffset;
|
|
1788
|
+
|
|
1789
|
+
// Whether the target offset changed after the first offset move.
|
|
1628
1790
|
const offsetChanged = postOffset !== offset;
|
|
1791
|
+
|
|
1792
|
+
// Difference between the current offset move and the move already applied.
|
|
1629
1793
|
const postDiff = postOffsetDiff - offsetDiff;
|
|
1630
|
-
|
|
1794
|
+
|
|
1795
|
+
// If the first offset move already normalized a target DST gap forward, the
|
|
1796
|
+
// generic post-DST correction below would undo that valid normalization. This
|
|
1797
|
+
// happens, for example, with America/New_York 02:00 during spring-forward when
|
|
1798
|
+
// the system zone also changes offset around the same instant.
|
|
1799
|
+
const targetDSTShift = postOffset - offset;
|
|
1800
|
+
|
|
1801
|
+
// Candidate timestamp that would represent the requested wall-clock time with
|
|
1802
|
+
// the post-transition target offset. If it still does not round-trip to the
|
|
1803
|
+
// requested wall-clock fields, the requested time is inside a target DST gap.
|
|
1804
|
+
const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1000;
|
|
1805
|
+
|
|
1806
|
+
// Only positive target offset shifts are spring-forward gaps. Negative shifts
|
|
1807
|
+
// are fall-back overlaps and still need the regular post-adjustment path.
|
|
1808
|
+
const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1000 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime;
|
|
1809
|
+
if (offsetChanged && postDiff && !normalizedTargetDSTGap) {
|
|
1810
|
+
// Apply the target-DST correction to external. In the backward-crossing case
|
|
1811
|
+
// shown here, this lands on an intermediate value that needs `offsetChange`
|
|
1812
|
+
// below.
|
|
1813
|
+
//
|
|
1814
|
+
// o external as America/New_York: 2023-03-12 03:00 EDT
|
|
1815
|
+
// |
|
|
1816
|
+
// | + `postDiff`
|
|
1817
|
+
// v
|
|
1818
|
+
// x external as America/New_York: 2023-03-12 01:00 EST
|
|
1819
|
+
//
|
|
1631
1820
|
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
|
|
1632
1821
|
|
|
1633
|
-
//
|
|
1634
|
-
//
|
|
1822
|
+
// Target offset after applying `postDiff`. It may change again if the
|
|
1823
|
+
// correction itself crosses a target-zone DST boundary.
|
|
1824
|
+
const newOffsetWithSeconds = tzOffset(date.timeZone, date);
|
|
1825
|
+
|
|
1826
|
+
// Minute-precision target offset after applying `postDiff`.
|
|
1827
|
+
const newOffset = newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds);
|
|
1635
1828
|
|
|
1636
|
-
|
|
1637
|
-
// Remove the seconds offset
|
|
1638
|
-
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
1639
|
-
const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
|
|
1829
|
+
// Offset change caused by the `postDiff` move itself.
|
|
1640
1830
|
const offsetChange = postOffset - newOffset;
|
|
1641
|
-
|
|
1642
|
-
|
|
1831
|
+
|
|
1832
|
+
// If the correction moved external backward across the target DST boundary,
|
|
1833
|
+
// apply the boundary change so external lands on the valid target-zone
|
|
1834
|
+
// timestamp. Forward crossings are already normalized by native Date, and
|
|
1835
|
+
// applying this correction there would undo the valid post-DST result.
|
|
1836
|
+
if (offsetChange && postDiff < 0) {
|
|
1837
|
+
// Apply the second target-DST correction to external.
|
|
1838
|
+
//
|
|
1839
|
+
// o external as America/New_York: 2023-03-12 01:00 EST
|
|
1840
|
+
// |
|
|
1841
|
+
// | + `offsetChange`
|
|
1842
|
+
// v
|
|
1843
|
+
// x external as America/New_York: 2023-03-12 03:00 EDT
|
|
1844
|
+
//
|
|
1643
1845
|
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
|
|
1644
1846
|
}
|
|
1645
1847
|
}
|
|
1646
1848
|
|
|
1647
1849
|
//#endregion
|
|
1850
|
+
|
|
1851
|
+
// Rebuild internal wall-clock fields from the final external timestamp.
|
|
1852
|
+
syncToInternal(date);
|
|
1853
|
+
|
|
1854
|
+
// Native Date can normalize historical system offsets with minute and second
|
|
1855
|
+
// precision before we adjust to the target time zone. Correct only small
|
|
1856
|
+
// historical drift so DST gap normalization (usually one hour) remains intact.
|
|
1857
|
+
const expectedTime = constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1000;
|
|
1858
|
+
const drift = expectedTime - +date.internal;
|
|
1859
|
+
if (drift && Math.abs(drift) < 30 * 60 * 1000) {
|
|
1860
|
+
Date.prototype.setTime.call(date, +date + drift);
|
|
1861
|
+
syncToInternal(date);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
function constructorArgsToInternalTime(args) {
|
|
1865
|
+
// Mirror Date's date-value constructor defaults while preserving explicit
|
|
1866
|
+
// `undefined` behavior. Missing month/day default, but passed `undefined`
|
|
1867
|
+
// should remain invalid just like `Date.UTC(year, undefined, ...)`.
|
|
1868
|
+
return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3));
|
|
1869
|
+
}
|
|
1870
|
+
function targetInternalTime(date, time) {
|
|
1871
|
+
// Compute the target-zone wall-clock representation for a timestamp without
|
|
1872
|
+
// mutating the TZDate. This mirrors syncToInternal for temporary checks.
|
|
1873
|
+
const internal = new Date(time ?? +date);
|
|
1874
|
+
internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60));
|
|
1875
|
+
return +internal;
|
|
1648
1876
|
}
|
|
1649
1877
|
|
|
1650
1878
|
class TZDate extends TZDateMini {
|
|
@@ -2458,7 +2686,7 @@ const ptBR = {
|
|
|
2458
2686
|
},
|
|
2459
2687
|
};
|
|
2460
2688
|
|
|
2461
|
-
var styles$r = {"root":"Calendar-module__root___vQEhz","day":"Calendar-module__day___dseUA","day_button":"Calendar-module__day_button___r3WNU","caption_label":"Calendar-module__caption_label___Dhkie","button_next":"Calendar-module__button_next___iRaNz","button_previous":"Calendar-module__button_previous___r7JBs","chevron":"Calendar-module__chevron___NPDg-","nav":"Calendar-module__nav___MT3Dm","dropdowns":"Calendar-module__dropdowns___xBVtv","dropdown":"Calendar-module__dropdown___D7OlW","dropdown_root":"Calendar-module__dropdown_root___v4DlK","month_caption":"Calendar-module__month_caption___P3Hlu","month":"Calendar-module__month___0RA-L","months":"Calendar-module__months___rmJdy","month_grid":"Calendar-module__month_grid___f6YkX","weekday":"Calendar-module__weekday___Spb2f","week_number":"Calendar-module__week_number___EXJD9","today":"Calendar-module__today___U36wP","outside":"Calendar-module__outside___UeJFZ","selected":"Calendar-module__selected___5Nryr","disabled":"Calendar-module__disabled___T3658","hidden":"Calendar-module__hidden___uL3uc","
|
|
2689
|
+
var styles$r = {"root":"Calendar-module__root___vQEhz","day":"Calendar-module__day___dseUA","day_button":"Calendar-module__day_button___r3WNU","caption_label":"Calendar-module__caption_label___Dhkie","button_next":"Calendar-module__button_next___iRaNz","button_previous":"Calendar-module__button_previous___r7JBs","chevron":"Calendar-module__chevron___NPDg-","nav":"Calendar-module__nav___MT3Dm","dropdowns":"Calendar-module__dropdowns___xBVtv","dropdown":"Calendar-module__dropdown___D7OlW","dropdown_root":"Calendar-module__dropdown_root___v4DlK","month_caption":"Calendar-module__month_caption___P3Hlu","month":"Calendar-module__month___0RA-L","months":"Calendar-module__months___rmJdy","month_grid":"Calendar-module__month_grid___f6YkX","weekday":"Calendar-module__weekday___Spb2f","week_number":"Calendar-module__week_number___EXJD9","today":"Calendar-module__today___U36wP","outside":"Calendar-module__outside___UeJFZ","selected":"Calendar-module__selected___5Nryr","disabled":"Calendar-module__disabled___T3658","hidden":"Calendar-module__hidden___uL3uc","range_middle":"Calendar-module__range_middle___Uv4gt","range_start":"Calendar-module__range_start___c1eNH","range_end":"Calendar-module__range_end___4qDh5","focusable":"Calendar-module__focusable___V7w-Q","weeks_before_enter":"Calendar-module__weeks_before_enter___O1ytQ","slide_in_left":"Calendar-module__slide_in_left___hfrfr","weeks_before_exit":"Calendar-module__weeks_before_exit___v7nDr","slide_out_left":"Calendar-module__slide_out_left___kib4j","weeks_after_enter":"Calendar-module__weeks_after_enter___CEtsD","slide_in_right":"Calendar-module__slide_in_right___ldL0M","weeks_after_exit":"Calendar-module__weeks_after_exit___F8Edz","slide_out_right":"Calendar-module__slide_out_right___X2hxE","caption_after_enter":"Calendar-module__caption_after_enter___0ek1H","fade_in":"Calendar-module__fade_in___YyYoZ","caption_after_exit":"Calendar-module__caption_after_exit___RA1iK","fade_out":"Calendar-module__fade_out___lNcmB","caption_before_enter":"Calendar-module__caption_before_enter___j6sMK","caption_before_exit":"Calendar-module__caption_before_exit___rntl-","calendar_grid_wrapper":"Calendar-module__calendar_grid_wrapper___OX0TR","caption_grid_btn":"Calendar-module__caption_grid_btn___qD0-E","caption_year_chevron":"Calendar-module__caption_year_chevron___4ghQV","caption_grid_label":"Calendar-module__caption_grid_label___93Wx4","gridOverlay":"Calendar-module__gridOverlay___Za-y0","gridOverlayCaption":"Calendar-module__gridOverlayCaption___p4OUO","gridOverlayYearsNav":"Calendar-module__gridOverlayYearsNav___U6S-V","gridCells":"Calendar-module__gridCells___Y8DaG","gridCellsYears":"Calendar-module__gridCellsYears___jEV52","gridCell":"Calendar-module__gridCell___RV1co","gridCellActive":"Calendar-module__gridCellActive___UBi5y","gridNavBtn":"Calendar-module__gridNavBtn___Jligz","chevronNavBtnPrev":"Calendar-module__chevronNavBtnPrev___ifEps","chevronNavBtnNext":"Calendar-module__chevronNavBtnNext___qmghm","chevron_wrapper":"Calendar-module__chevron_wrapper___BfN9a"};
|
|
2462
2690
|
|
|
2463
2691
|
const FLUENT_CHEVRON_MAP = {
|
|
2464
2692
|
down: reactIcons.ChevronDown16Regular,
|
|
@@ -2480,15 +2708,19 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2480
2708
|
return (jsxRuntime.jsxs("div", { ...divProps, children: [jsxRuntime.jsx("span", { className: styles$r.caption_grid_label, children: monthLabel }), jsxRuntime.jsxs("button", { type: "button", className: styles$r.caption_grid_btn, "aria-pressed": view === "years", onClick: onYearLabelClick, children: [yearLabel, view !== "days" ? (jsxRuntime.jsx("span", { className: styles$r.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) })) : (jsxRuntime.jsx("span", { className: styles$r.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronDown16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) }))] })] }));
|
|
2481
2709
|
};
|
|
2482
2710
|
const YEARS_PER_PAGE = 20;
|
|
2483
|
-
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear
|
|
2711
|
+
const Calendar = ({ mode = "single", selected, selectedRange, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onRangeSelect, onDateChange, onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, numberOfMonths, className, style, scale = 1, id, "aria-label": ariaLabel, ...rest }) => {
|
|
2484
2712
|
const animate = true;
|
|
2485
2713
|
const [internalSelected, setInternalSelected] = React.useState(selected ?? undefined);
|
|
2714
|
+
const [internalRange, setInternalRange] = React.useState(selectedRange ?? undefined);
|
|
2486
2715
|
const [internalDisplayMonth, setInternalDisplayMonth] = React.useState(() => currentDate ?? defaultMonth ?? new Date());
|
|
2487
2716
|
const [gridView, setGridView] = React.useState("days");
|
|
2488
2717
|
const [yearPageStart, setYearPageStart] = React.useState(() => (currentDate ?? defaultMonth ?? new Date()).getFullYear() - 9);
|
|
2489
2718
|
const resolvedSelected = selected !== undefined
|
|
2490
2719
|
? (selected ?? undefined)
|
|
2491
2720
|
: internalSelected;
|
|
2721
|
+
const resolvedRange = selectedRange !== undefined
|
|
2722
|
+
? (selectedRange ?? undefined)
|
|
2723
|
+
: internalRange;
|
|
2492
2724
|
const resolvedLocale = locale === "pt-br" ? ptBR : enUS;
|
|
2493
2725
|
const intlLocale = locale === "pt-br" ? "pt-BR" : "en-US";
|
|
2494
2726
|
const disabledMatchers = [
|
|
@@ -2501,6 +2733,33 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2501
2733
|
if (date) {
|
|
2502
2734
|
onDaySelect?.(date);
|
|
2503
2735
|
}
|
|
2736
|
+
else {
|
|
2737
|
+
onClear?.();
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
const handleRangeSelect = (range, selectedDay) => {
|
|
2741
|
+
const current = resolvedRange;
|
|
2742
|
+
// Desselecionar: apenas um dia marcado (to ausente ou to = from) e o usuário clicou nele
|
|
2743
|
+
const isSingleDaySelected = current?.from != null &&
|
|
2744
|
+
(current.to == null || current.from.getTime() === current.to.getTime());
|
|
2745
|
+
if (isSingleDaySelected && current?.from?.getTime() === selectedDay.getTime()) {
|
|
2746
|
+
setInternalRange(undefined);
|
|
2747
|
+
onRangeSelect?.(undefined);
|
|
2748
|
+
onClear?.();
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
// Range completo (from ≠ to): reinicia a seleção com o dia clicado
|
|
2752
|
+
const isComplete = current?.from != null &&
|
|
2753
|
+
current?.to != null &&
|
|
2754
|
+
current.from.getTime() !== current.to.getTime();
|
|
2755
|
+
if (isComplete) {
|
|
2756
|
+
const fresh = { from: selectedDay, to: undefined };
|
|
2757
|
+
setInternalRange(fresh);
|
|
2758
|
+
onRangeSelect?.(fresh);
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
setInternalRange(range);
|
|
2762
|
+
onRangeSelect?.(range);
|
|
2504
2763
|
};
|
|
2505
2764
|
const handleMonthChange = (date) => {
|
|
2506
2765
|
setInternalDisplayMonth(date);
|
|
@@ -2547,18 +2806,20 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2547
2806
|
const sharedDayPickerProps = {
|
|
2548
2807
|
classNames: styles$r,
|
|
2549
2808
|
animate,
|
|
2550
|
-
mode: "single",
|
|
2551
|
-
selected: resolvedSelected,
|
|
2552
|
-
onSelect: handleSelect,
|
|
2553
2809
|
startMonth,
|
|
2554
2810
|
endMonth,
|
|
2555
2811
|
disabled: disabledMatchers.length > 0 ? disabledMatchers : undefined,
|
|
2556
2812
|
locale: resolvedLocale,
|
|
2557
2813
|
autoFocus,
|
|
2558
2814
|
"aria-label": ariaLabel,
|
|
2815
|
+
captionLayout: "label",
|
|
2816
|
+
numberOfMonths,
|
|
2817
|
+
month: resolvedDisplayMonth,
|
|
2818
|
+
onMonthChange: handleMonthChange,
|
|
2819
|
+
components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron },
|
|
2559
2820
|
};
|
|
2560
2821
|
const containerStyle = { '--giro-scale': scale };
|
|
2561
|
-
return (jsxRuntime.jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxRuntime.jsxs("div", { className: clsx(styles$r.calendar_grid_wrapper, className), style: { ...containerStyle, ...style }, children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { id: id, ...sharedDayPickerProps, ...rest,
|
|
2822
|
+
return (jsxRuntime.jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxRuntime.jsxs("div", { className: clsx(styles$r.calendar_grid_wrapper, className), style: { ...containerStyle, ...style }, children: [mode === "range" ? (jsxRuntime.jsx(reactDayPicker.DayPicker, { id: id, ...sharedDayPickerProps, ...rest, mode: "range", selected: resolvedRange, onSelect: handleRangeSelect })) : (jsxRuntime.jsx(reactDayPicker.DayPicker, { id: id, ...sharedDayPickerProps, ...rest, mode: "single", selected: resolvedSelected, onSelect: handleSelect })), gridView !== "days" && (jsxRuntime.jsxs("div", { className: `${styles$r.gridOverlay}${gridView === "years" ? ` ${styles$r.gridOverlayYears}` : ""}`, role: "dialog", "aria-modal": "true", "aria-label": gridView === "months" ? "Selecione o mês" : "Selecione o ano", children: [gridView === "months" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$r.gridOverlayCaption, children: [jsxRuntime.jsx("span", { className: styles$r.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxRuntime.jsxs("button", { type: "button", className: styles$r.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsxRuntime.jsx("span", { className: styles$r.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) })] })] }), jsxRuntime.jsx("div", { className: styles$r.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsxRuntime.jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$r.gridCell}${displayedMonthIndex === index ? ` ${styles$r.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$r.gridOverlayCaption, children: [jsxRuntime.jsx("span", { className: styles$r.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxRuntime.jsxs("button", { type: "button", className: styles$r.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsxRuntime.jsx("span", { className: styles$r.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) })] }), jsxRuntime.jsxs("div", { className: styles$r.gridOverlayYearsNav, children: [jsxRuntime.jsx("button", { type: "button", className: styles$r.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsxRuntime.jsx("span", { className: styles$r.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronLeft16Regular, { className: styles$r.chevronNavBtnPrev, "aria-hidden": true }) }) }), jsxRuntime.jsx("button", { type: "button", className: styles$r.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsxRuntime.jsx("span", { className: styles$r.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronRight16Regular, { className: styles$r.chevronNavBtnNext, "aria-hidden": true }) }) })] })] }), jsxRuntime.jsx("div", { className: `${styles$r.gridCells} ${styles$r.gridCellsYears}`, children: yearsInPage.map((year) => (jsxRuntime.jsx("button", { type: "button", className: `${styles$r.gridCell}${displayedYear === year ? ` ${styles$r.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2562
2823
|
};
|
|
2563
2824
|
|
|
2564
2825
|
var styles$q = {"container":"Callout-module__container___dggFW","withTitle":"Callout-module__withTitle___e-HEg","brand":"Callout-module__brand___YHDPQ","success":"Callout-module__success___RPS0Q","alert":"Callout-module__alert___LVlJM","content":"Callout-module__content___g44Qz","icon":"Callout-module__icon___4CBkz","subcontent":"Callout-module__subcontent___5hz-f","title":"Callout-module__title___IPSdE","text":"Callout-module__text___0Ys48","dismiss":"Callout-module__dismiss___ZaycS"};
|
|
@@ -2618,7 +2879,15 @@ const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled =
|
|
|
2618
2879
|
...style,
|
|
2619
2880
|
};
|
|
2620
2881
|
const isInteractive = typeof rest.onClick === 'function';
|
|
2621
|
-
|
|
2882
|
+
const { onKeyDown: userOnKeyDown, ...otherRest } = rest;
|
|
2883
|
+
const handleKeyDown = (e) => {
|
|
2884
|
+
userOnKeyDown?.(e);
|
|
2885
|
+
if (!e.defaultPrevented && isInteractive && !disabled && (e.key === 'Enter' || e.key === ' ')) {
|
|
2886
|
+
e.preventDefault();
|
|
2887
|
+
rest.onClick?.(e);
|
|
2888
|
+
}
|
|
2889
|
+
};
|
|
2890
|
+
return (jsxRuntime.jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, onKeyDown: handleKeyDown, ...otherRest, children: [leftIcon && (jsxRuntime.jsx("span", { className: styles$n.iconLeft, "aria-hidden": "true", children: leftIcon })), jsxRuntime.jsx("span", { className: styles$n.title, children: children }), rightIcon && (jsxRuntime.jsx("span", { className: styles$n.iconRight, "aria-hidden": "true", children: rightIcon }))] }));
|
|
2622
2891
|
};
|
|
2623
2892
|
const MemoizedChips = React.memo(Chips);
|
|
2624
2893
|
MemoizedChips.displayName = 'Chips';
|
|
@@ -2629,10 +2898,10 @@ function Container({ children, className }) {
|
|
|
2629
2898
|
return (jsxRuntime.jsx("main", { className: clsx(styles$m['container'], 'mx-auto', className), children: children }));
|
|
2630
2899
|
}
|
|
2631
2900
|
|
|
2632
|
-
var styles$l = {"Content":"Popover-module__Content___RIETg"};
|
|
2901
|
+
var styles$l = {"Content":"Popover-module__Content___RIETg","Arrow":"Popover-module__Arrow___ue4Mg"};
|
|
2633
2902
|
|
|
2634
2903
|
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, className, ...rest }) => {
|
|
2635
|
-
return (jsxRuntime.jsxs(radixUi.Popover.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsxRuntime.jsx(radixUi.Popover.Anchor, { asChild: true, children: trigger })) : (jsxRuntime.jsx(radixUi.Popover.Trigger, { asChild: true, children: trigger })), jsxRuntime.jsx(radixUi.Popover.Portal, { children: jsxRuntime.jsxs(radixUi.Popover.Content, { className: clsx(styles$l.Content, className), sideOffset: sideOffset, side: side, align: align, onOpenAutoFocus: asAnchor ? (e) => e.preventDefault() : onOpenAutoFocus, onCloseAutoFocus: asAnchor ? (e) => e.preventDefault() : onCloseAutoFocus, onInteractOutside: asAnchor ? (e) => e.preventDefault() : undefined, children: [content, showArrow && jsxRuntime.jsx(radixUi.Popover.Arrow, {})] }) })] }));
|
|
2904
|
+
return (jsxRuntime.jsxs(radixUi.Popover.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsxRuntime.jsx(radixUi.Popover.Anchor, { asChild: true, children: trigger })) : (jsxRuntime.jsx(radixUi.Popover.Trigger, { asChild: true, children: trigger })), jsxRuntime.jsx(radixUi.Popover.Portal, { children: jsxRuntime.jsxs(radixUi.Popover.Content, { className: clsx(styles$l.Content, className), sideOffset: sideOffset, side: side, align: align, onOpenAutoFocus: asAnchor ? (e) => e.preventDefault() : onOpenAutoFocus, onCloseAutoFocus: asAnchor ? (e) => e.preventDefault() : onCloseAutoFocus, onInteractOutside: asAnchor ? (e) => e.preventDefault() : undefined, children: [content, showArrow && jsxRuntime.jsx(radixUi.Popover.Arrow, { className: styles$l.Arrow })] }) })] }));
|
|
2636
2905
|
};
|
|
2637
2906
|
|
|
2638
2907
|
function useInputKeyboardValue(externalRef) {
|
|
@@ -2831,7 +3100,7 @@ const ACCENT_OPTIONS = {
|
|
|
2831
3100
|
* <VirtualKeyboard targetRef={inputRef} value={value} onChange={setValue} />
|
|
2832
3101
|
* ```
|
|
2833
3102
|
*/
|
|
2834
|
-
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, onTypeChange, maxLength, Emoji = false, className, id,
|
|
3103
|
+
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, onTypeChange, maxLength, Emoji = false, className, id, placeholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, textFieldScale = 1, showEnterKey = true, showTypeSwitchKey = true, }) => {
|
|
2835
3104
|
const [layoutName, setLayoutName] = React.useState('default');
|
|
2836
3105
|
const [capsLockOn, setCapsLockOn] = React.useState(false);
|
|
2837
3106
|
const [accentMenu, setAccentMenu] = React.useState(null);
|
|
@@ -3346,7 +3615,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3346
3615
|
if (variant === 'native' && typeof document !== 'undefined') {
|
|
3347
3616
|
return reactDom.createPortal(jsxRuntime.jsx("div", { id: id, className: clsx(styles$k.overlay, { [styles$k.overlayOpen]: isOpen }, styles$k[`layout--${visualType}`], className), children: keyboardEl }), document.body);
|
|
3348
3617
|
}
|
|
3349
|
-
return (jsxRuntime.jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsxRuntime.jsx("div", { className: styles$k.textFieldContainer, children: jsxRuntime.jsx(TextField, { placeholder:
|
|
3618
|
+
return (jsxRuntime.jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsxRuntime.jsx("div", { className: styles$k.textFieldContainer, children: jsxRuntime.jsx(TextField, { placeholder: placeholder, value: value, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, readOnly: true, disableAutoComplete: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$k.textFieldWrapper, scale: textFieldScale }) })), keyboardEl] }));
|
|
3350
3619
|
};
|
|
3351
3620
|
|
|
3352
3621
|
var styles$j = {"container":"TextField-module__container___WJHFR","inputWrapper":"TextField-module__inputWrapper___INjfd","inputContainer":"TextField-module__inputContainer___3EsFJ","icon":"TextField-module__icon___p1vwi","clearButton":"TextField-module__clearButton___kgOot","inputWithIcon":"TextField-module__inputWithIcon___shqkL","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP","attachedToVirtualKeyboard":"TextField-module__attachedToVirtualKeyboard___fuO2O","errorWithMessage":"TextField-module__errorWithMessage___m-5AA","clearButtonIcon":"TextField-module__clearButtonIcon___Z2iyc"};
|
|
@@ -3375,7 +3644,7 @@ const LabelComponent = ({ children, htmlFor, required = false, tooltip = false,
|
|
|
3375
3644
|
return container;
|
|
3376
3645
|
};
|
|
3377
3646
|
|
|
3378
|
-
const TextField$1 =
|
|
3647
|
+
const TextField$1 = ({ ref, className, style, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength, required = false, helperText, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, icon, scale = 1, onBlur, onFocus, name, persistIcon = false, virtualKeyboard, attachedToVirtualKeyboard, disableAutoComplete = false, ...rest }) => {
|
|
3379
3648
|
const normalizeValue = (val) => {
|
|
3380
3649
|
return val === undefined || val === null ? '' : String(val);
|
|
3381
3650
|
};
|
|
@@ -3426,7 +3695,7 @@ const TextField$1 = React.forwardRef(({ className, style, value, label, placehol
|
|
|
3426
3695
|
setIsFocused(true);
|
|
3427
3696
|
onFocus?.(e);
|
|
3428
3697
|
}, [onFocus]);
|
|
3429
|
-
const showCustomIcon = inputValue.trim().length === 0 && icon;
|
|
3698
|
+
const showCustomIcon = (inputValue.trim().length === 0 || persistIcon) && icon;
|
|
3430
3699
|
const showClearIcon = isFocused && inputValue.trim().length > 0;
|
|
3431
3700
|
const hasError = Boolean(inputError) || Boolean(error);
|
|
3432
3701
|
const displayHelperText = (error ? errorMessage : undefined) || inputError || helperText || '\u00A0';
|
|
@@ -3436,14 +3705,13 @@ const TextField$1 = React.forwardRef(({ className, style, value, label, placehol
|
|
|
3436
3705
|
? `${componentId}-helper`
|
|
3437
3706
|
: undefined;
|
|
3438
3707
|
const containerStyle = { '--giro-scale': scale };
|
|
3439
|
-
const containerClass = clsx(styles$j.container, {
|
|
3708
|
+
const containerClass = clsx(styles$j.container, className, {
|
|
3440
3709
|
[styles$j.attachedToVirtualKeyboard]: attachedToVirtualKeyboard,
|
|
3441
3710
|
[styles$j.disabled]: disabled,
|
|
3442
3711
|
[styles$j.error]: error,
|
|
3443
3712
|
[styles$j.errorWithMessage]: !!errorMessage,
|
|
3444
|
-
[className]: className,
|
|
3445
3713
|
});
|
|
3446
|
-
return (jsxRuntime.jsxs("div", { className: containerClass, style: { ...containerStyle, ...style }, children: [label && (jsxRuntime.jsx(LabelComponent, { scale: scale, htmlFor: componentId, required: required, tooltip:
|
|
3714
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, style: { ...containerStyle, ...style }, children: [label && (jsxRuntime.jsx(LabelComponent, { scale: scale, htmlFor: componentId, required: required, tooltip: !!tooltipText, tooltipText: tooltipText, side: tooltipSide, align: tooltipAlign, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$j.inputWrapper, children: [jsxRuntime.jsxs("div", { className: styles$j.inputContainer, children: [jsxRuntime.jsx("input", { ...rest, ref: setInputRefs, id: componentId, name: name, type: type, value: inputValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId, inputMode: (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') ? 'none' : rest.inputMode, autoComplete: (disableAutoComplete || virtualKeyboard === 'default' || virtualKeyboard === 'numeric') ? 'off' : rest.autoComplete, className: clsx({
|
|
3447
3715
|
[styles$j.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
3448
3716
|
}) }), showCustomIcon && jsxRuntime.jsx("span", { className: styles$j.icon, children: icon }), showClearIcon && (jsxRuntime.jsx("button", { type: "button", className: styles$j.clearButton, onMouseDown: (e) => {
|
|
3449
3717
|
e.preventDefault();
|
|
@@ -3454,7 +3722,7 @@ const TextField$1 = React.forwardRef(({ className, style, value, label, placehol
|
|
|
3454
3722
|
onChange?.(val);
|
|
3455
3723
|
}
|
|
3456
3724
|
} }) }))] }));
|
|
3457
|
-
}
|
|
3725
|
+
};
|
|
3458
3726
|
TextField$1.displayName = 'TextField';
|
|
3459
3727
|
var TextField = React.memo(TextField$1);
|
|
3460
3728
|
|
|
@@ -3784,7 +4052,7 @@ const matchesAccept = (file, accept) => {
|
|
|
3784
4052
|
return fileType === type;
|
|
3785
4053
|
});
|
|
3786
4054
|
};
|
|
3787
|
-
const FileUpload =
|
|
4055
|
+
const FileUpload = ({ ref, value, onChange, helperText, error = false, errorMessage, maxFileSize, maxFilesQuantity, disabled = false, className, id, accept, multiple = true, description = 'Clique ou arraste os arquivos aqui', descriptionErrorMessage = 'Falha ao subir um ou mais arquivos.', ...rest }) => {
|
|
3788
4056
|
const generatedId = React.useId();
|
|
3789
4057
|
const componentId = id || generatedId;
|
|
3790
4058
|
const helperId = `${componentId}-helper`;
|
|
@@ -3919,12 +4187,12 @@ const FileUpload = React.forwardRef(({ value, onChange, helperText, error = fals
|
|
|
3919
4187
|
}
|
|
3920
4188
|
}, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, { "aria-hidden": "true" }) })] }, `${file.name}-${index}`));
|
|
3921
4189
|
}) }))] }), displayedHelper && (jsxRuntime.jsx("span", { id: helperId, role: isError ? 'alert' : undefined, className: clsx(styles$e.helperText, isError && styles$e.errorText), children: displayedHelper }))] }));
|
|
3922
|
-
}
|
|
4190
|
+
};
|
|
3923
4191
|
FileUpload.displayName = 'FileUpload';
|
|
3924
4192
|
|
|
3925
4193
|
var styles$d = {"container":"Filter-module__container___cqntK","panel":"Filter-module__panel___19HqD","search":"Filter-module__search___f0gzj","list":"Filter-module__list___UpBk1","item":"Filter-module__item___oNdeY","itemSelected":"Filter-module__itemSelected___JIpJV","itemText":"Filter-module__itemText___RS--0","itemDisabled":"Filter-module__itemDisabled___X-ktg","itemIcon":"Filter-module__itemIcon___RjJSa","noResults":"Filter-module__noResults___3m6pn","footer":"Filter-module__footer___yYS5j","buttonContent":"Filter-module__buttonContent___28fKe","buttonArrow":"Filter-module__buttonArrow___VJlpc","buttonIcon":"Filter-module__buttonIcon___OOBpZ","triggerWrapper":"Filter-module__triggerWrapper___ptPRL","triggerContent":"Filter-module__triggerContent___LYo9j","body":"Filter-module__body___qsyhk","combinedFooter":"Filter-module__combinedFooter___kTnHP"};
|
|
3926
4194
|
|
|
3927
|
-
const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled = false, className, title = 'Filtrar', drawerWidth = "fit-content",
|
|
4195
|
+
const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled = false, className, title = 'Filtrar', drawerWidth = "fit-content", appliedFilterCount = 0, drawerHeaderContent, children, onApply, onClear, onOpen, onClose, id, ...rest }) => {
|
|
3928
4196
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
3929
4197
|
const handleOpen = React.useCallback(() => {
|
|
3930
4198
|
setIsOpen(true);
|
|
@@ -3941,12 +4209,12 @@ const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled
|
|
|
3941
4209
|
const handleClear = React.useCallback(() => {
|
|
3942
4210
|
onClear?.();
|
|
3943
4211
|
}, [onClear]);
|
|
3944
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$d.triggerWrapper, className), id: id, ...rest, children: [jsxRuntime.jsx(Button, { variant: variant, disabled: disabled, icon: icon ?? jsxRuntime.jsx(reactIcons.FilterRegular, {}), iconPosition: "left", onClick: handleOpen, children: jsxRuntime.jsxs("span", { className: styles$d.triggerContent, children: [buttonText,
|
|
4212
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$d.triggerWrapper, className), id: id, ...rest, children: [jsxRuntime.jsx(Button, { variant: variant, disabled: disabled, icon: icon ?? jsxRuntime.jsx(reactIcons.FilterRegular, {}), iconPosition: "left", onClick: handleOpen, children: jsxRuntime.jsxs("span", { className: styles$d.triggerContent, children: [buttonText, appliedFilterCount > 0 && (jsxRuntime.jsx(Badge, { badgeValue: appliedFilterCount, filterVariant: true }))] }) }), jsxRuntime.jsx(Drawer, { isOpen: isOpen, onClose: handleClose, title: title, customWidth: drawerWidth, closeOnOverlayClick: true, closeOnEscape: true, headerContent: drawerHeaderContent, footer: jsxRuntime.jsxs("div", { className: styles$d.combinedFooter, children: [jsxRuntime.jsx(Button, { variant: "outlined", onClick: handleClear, children: "Limpar" }), jsxRuntime.jsx(Button, { onClick: handleApply, children: "Aplicar" })] }), children: jsxRuntime.jsx("div", { className: styles$d.body, children: children }) })] }));
|
|
3945
4213
|
};
|
|
3946
4214
|
|
|
3947
4215
|
var styles$c = {"search":"Search-module__search___u3QsV","searchLeftIcon":"Search-module__searchLeftIcon___OKOBq","disabled":"Search-module__disabled___adbxO","inputWithClearIcon":"Search-module__inputWithClearIcon___cqvkq","searchClearIcon":"Search-module__searchClearIcon___qX9-h"};
|
|
3948
4216
|
|
|
3949
|
-
const Search =
|
|
4217
|
+
const Search = ({ ref, placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, searchMode = 'instant', onSearch, id, scale = 1, className, style, virtualKeyboard, 'data-testid': testId, ...rest }) => {
|
|
3950
4218
|
const [internalValue, setInternalValue] = React.useState('');
|
|
3951
4219
|
const { internalRef: inputRef, setRefs: setInputRefs } = useInputKeyboardValue(ref);
|
|
3952
4220
|
const isControlled = value !== undefined && onChange !== undefined;
|
|
@@ -4018,7 +4286,7 @@ const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado',
|
|
|
4018
4286
|
setInternalValue(val);
|
|
4019
4287
|
}
|
|
4020
4288
|
} }) }))] }));
|
|
4021
|
-
}
|
|
4289
|
+
};
|
|
4022
4290
|
Search.displayName = 'Search';
|
|
4023
4291
|
|
|
4024
4292
|
const Simple = ({ items, type = 'multiple', selectedIds, onApplyFilter, placeholder = 'Selecionar...', enableSearch = false, buttonText = 'Filter', icon, variant = 'outlined', onOpen, onClose, side = 'bottom', align = 'start', disabled = false, className, selectedDate, onDateSelect, onClearDate, minDate, maxDate, locale = 'pt-br', id, ...rest }) => {
|
|
@@ -4775,13 +5043,13 @@ const ExpandableSelectItem = ({ item, variant, onSelect, selectedValues, level =
|
|
|
4775
5043
|
}, role: "button", tabIndex: item.disabled ? -1 : 0, "data-disabled": item.disabled || undefined, "data-selected": isSelected && !hasChildren ? 'true' : undefined, "data-testid": `select-item-${item.value}`, children: [variant === 'icon' && item.icon && (jsxRuntime.jsx("span", { className: styles$6.icon, children: item.icon })), jsxRuntime.jsxs("div", { className: styles$6.textContent, children: [jsxRuntime.jsx("div", { className: styles$6.title, children: item.text }), item.subTitle && jsxRuntime.jsx("div", { className: styles$6.subTitle, children: item.subTitle })] }), hasChildren && (jsxRuntime.jsx("span", { className: styles$6.chevron, children: isExpanded ? jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronRight16Regular, {}) }))] }) }), hasChildren && isExpanded && (jsxRuntime.jsx("div", { className: styles$6.childrenWrapper, children: item.children.map((child) => (jsxRuntime.jsx(ExpandableSelectItem, { item: child, variant: variant, onSelect: onSelect, selectedValues: selectedValues, level: level + 1 }, child.id || child.value))) }))] }));
|
|
4776
5044
|
};
|
|
4777
5045
|
|
|
4778
|
-
const SelectItem =
|
|
5046
|
+
const SelectItem = ({ ref, text, subTitle, icon, disabled, value, variant, disableFocusOnHover, ...restProps }) => {
|
|
4779
5047
|
return (jsxRuntime.jsxs("div", { className: clsx(styles$6.itemWrapper, {
|
|
4780
5048
|
[styles$6.disabled]: disabled,
|
|
4781
5049
|
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsxRuntime.jsx("span", { className: styles$6.icon, children: icon })), jsxRuntime.jsxs(radixUi.Select.Item, { className: clsx(styles$6.item, {
|
|
4782
5050
|
[styles$6.disabled]: disabled,
|
|
4783
5051
|
}), value: value, disabled: disabled, onPointerMove: disableFocusOnHover ? (e) => e.preventDefault() : undefined, ...restProps, children: [jsxRuntime.jsx(radixUi.Select.ItemText, { className: styles$6.title, children: text }), subTitle && jsxRuntime.jsx("div", { className: styles$6.subTitle, children: subTitle }), jsxRuntime.jsx(radixUi.Select.ItemIndicator, { className: styles$6.itemIndicator })] })] }));
|
|
4784
|
-
}
|
|
5052
|
+
};
|
|
4785
5053
|
SelectItem.displayName = 'SelectItem';
|
|
4786
5054
|
|
|
4787
5055
|
const initialState = {
|
|
@@ -4816,7 +5084,7 @@ function selectReducer(state, action) {
|
|
|
4816
5084
|
return state;
|
|
4817
5085
|
}
|
|
4818
5086
|
}
|
|
4819
|
-
function useSelectLogic({ value, required = false, search = false, onValueChange, onOpenChange, enableApiSearch = false, onApiSearch, isSearching = false, }) {
|
|
5087
|
+
function useSelectLogic({ value, required = false, search = false, onValueChange, onOpenChange, enableApiSearch = false, onApiSearch, isSearching = false, error, }) {
|
|
4820
5088
|
const [state, dispatch] = React.useReducer(selectReducer, {
|
|
4821
5089
|
...initialState,
|
|
4822
5090
|
selectedValues: Array.isArray(value) ? value : value ? [value] : [],
|
|
@@ -4843,6 +5111,14 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4843
5111
|
const newValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
4844
5112
|
dispatch({ type: 'SET_SELECTED_VALUES', payload: newValues });
|
|
4845
5113
|
}, [value]);
|
|
5114
|
+
React.useEffect(() => {
|
|
5115
|
+
if (error !== undefined) {
|
|
5116
|
+
dispatch({ type: 'SET_ERROR', payload: error });
|
|
5117
|
+
if (error) {
|
|
5118
|
+
dispatch({ type: 'SET_TOUCHED', payload: true });
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5121
|
+
}, [error]);
|
|
4846
5122
|
React.useEffect(() => {
|
|
4847
5123
|
if (state.isOpen && search) {
|
|
4848
5124
|
setTimeout(() => {
|
|
@@ -5009,7 +5285,7 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
5009
5285
|
};
|
|
5010
5286
|
}
|
|
5011
5287
|
|
|
5012
|
-
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, style, 'aria-label': ariaLabel, 'data-testid': testId,
|
|
5288
|
+
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, error, errorMessage, disabled = false, className, style, 'aria-label': ariaLabel, 'data-testid': testId, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, scale = 1, ...rest }) => {
|
|
5013
5289
|
const componentId = React.useId();
|
|
5014
5290
|
const selectId = `select-${componentId}`;
|
|
5015
5291
|
const viewportRef = React.useRef(null);
|
|
@@ -5023,6 +5299,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
5023
5299
|
enableApiSearch,
|
|
5024
5300
|
onApiSearch,
|
|
5025
5301
|
isSearching,
|
|
5302
|
+
error,
|
|
5026
5303
|
});
|
|
5027
5304
|
React.useEffect(() => {
|
|
5028
5305
|
const viewport = viewportRef.current;
|
|
@@ -5090,7 +5367,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
5090
5367
|
onApiSearch('');
|
|
5091
5368
|
}
|
|
5092
5369
|
};
|
|
5093
|
-
return (jsxRuntime.jsx(radixUi.Select.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...rest, children: jsxRuntime.jsxs("div", { className: clsx(styles$6.container, className), style: { ...containerStyle, ...style }, "data-testid": testId, children: [jsxRuntime.jsx("div", { className: styles$6.fieldContainer, children: jsxRuntime.jsxs("div", { className: styles$6.containerLabel, children: [jsxRuntime.jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip:
|
|
5370
|
+
return (jsxRuntime.jsx(radixUi.Select.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...rest, children: jsxRuntime.jsxs("div", { className: clsx(styles$6.container, className), style: { ...containerStyle, ...style }, "data-testid": testId, children: [jsxRuntime.jsx("div", { className: styles$6.fieldContainer, children: jsxRuntime.jsxs("div", { className: styles$6.containerLabel, children: [jsxRuntime.jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: !!tooltipText, side: tooltipSide, align: tooltipAlign, error: state.hasError && state.touched, disabled: disabled, scale: scale, children: label }), jsxRuntime.jsxs(radixUi.Select.Trigger, { className: clsx(styles$6.trigger, {
|
|
5094
5371
|
[styles$6.error]: state.hasError && state.touched,
|
|
5095
5372
|
[styles$6.disabled]: disabled,
|
|
5096
5373
|
[styles$6.hasValue]: state.selectedValues.length > 0,
|
|
@@ -5162,15 +5439,11 @@ function __rest(s, e) {
|
|
|
5162
5439
|
return t;
|
|
5163
5440
|
}
|
|
5164
5441
|
|
|
5165
|
-
var uid = (function () {
|
|
5166
|
-
return Math.random()
|
|
5167
|
-
.toString(36)
|
|
5168
|
-
.substring(6);
|
|
5169
|
-
});
|
|
5170
|
-
|
|
5171
5442
|
var SVG = function (_a) {
|
|
5172
5443
|
var _b = _a.animate, animate = _b === void 0 ? true : _b, _c = _a.backgroundColor, backgroundColor = _c === void 0 ? '#f5f6f7' : _c, _d = _a.backgroundOpacity, backgroundOpacity = _d === void 0 ? 1 : _d, _e = _a.baseUrl, baseUrl = _e === void 0 ? '' : _e, children = _a.children, _f = _a.foregroundColor, foregroundColor = _f === void 0 ? '#eee' : _f, _g = _a.foregroundOpacity, foregroundOpacity = _g === void 0 ? 1 : _g, _h = _a.gradientRatio, gradientRatio = _h === void 0 ? 2 : _h, uniqueKey = _a.uniqueKey, _j = _a.rtl, rtl = _j === void 0 ? false : _j, _k = _a.speed, speed = _k === void 0 ? 1.2 : _k, _l = _a.style, style = _l === void 0 ? {} : _l, _m = _a.title, title = _m === void 0 ? 'Loading...' : _m, _o = _a.beforeMask, beforeMask = _o === void 0 ? null : _o, props = __rest(_a, ["animate", "backgroundColor", "backgroundOpacity", "baseUrl", "children", "foregroundColor", "foregroundOpacity", "gradientRatio", "uniqueKey", "rtl", "speed", "style", "title", "beforeMask"]);
|
|
5173
|
-
var fixedId =
|
|
5444
|
+
var fixedId = React.useId();
|
|
5445
|
+
if (uniqueKey)
|
|
5446
|
+
fixedId = uniqueKey;
|
|
5174
5447
|
var idClip = "".concat(fixedId, "-diff");
|
|
5175
5448
|
var idGradient = "".concat(fixedId, "-animated-diff");
|
|
5176
5449
|
var idAria = "".concat(fixedId, "-aria");
|
|
@@ -5523,7 +5796,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5523
5796
|
onClose: () => filterItem.onToggle?.(false),
|
|
5524
5797
|
};
|
|
5525
5798
|
if (filterItem.type === 'combined') {
|
|
5526
|
-
return (jsxRuntime.jsx(Filter, { mode: "combined", buttonText: filterItem.buttonText, icon: filterItem.icon, title: filterItem.title, drawerWidth: filterItem.drawerWidth,
|
|
5799
|
+
return (jsxRuntime.jsx(Filter, { mode: "combined", buttonText: filterItem.buttonText, icon: filterItem.icon, title: filterItem.title, drawerWidth: filterItem.drawerWidth, appliedFilterCount: filterItem.activeCount, drawerHeaderContent: filterItem.drawerHeaderContent, onApply: filterItem.onApply, onClear: filterItem.onClear, variant: filterItem.variant ?? 'outlined', disabled: filterItem.disabled, children: filterItem.children }, filterItem.id ?? index));
|
|
5527
5800
|
}
|
|
5528
5801
|
if (filterItem.type === 'calendar') {
|
|
5529
5802
|
return (jsxRuntime.jsx(Filter, { ...commonProps, type: "calendar", selectedDate: filterItem.selectedDate, onDateSelect: filterItem.onDateSelect, onClearDate: filterItem.onClear, minDate: filterItem.minDate, maxDate: filterItem.maxDate, locale: filterItem.locale, placeholder: filterItem.placeholder }, filterItem.id ?? index));
|
|
@@ -5545,7 +5818,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5545
5818
|
maxWidth: cell.column.columnDef.maxSize !== Number.MAX_SAFE_INTEGER
|
|
5546
5819
|
? cell.column.columnDef.maxSize
|
|
5547
5820
|
: undefined,
|
|
5548
|
-
}, children:
|
|
5821
|
+
}, children: jsxRuntime.jsx("div", { className: styles$4.tableCellMaxHeight, style: { maxHeight: cell.column.columnDef.meta?.maxHeight ?? '64px' }, children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }) }, cell.id))) }, row.id));
|
|
5549
5822
|
})) : (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, className: styles$4.tableEmptyCell, children: jsxRuntime.jsx(EmptyState, { emptyIcon: emptyIcon, emptyTitle: emptyTitle, emptyText: emptyText }) }) })) })] }) }) }), footer && (jsxRuntime.jsxs("div", { className: styles$4.tablePagination, children: [jsxRuntime.jsxs("div", { className: styles$4.tablePaginationSelect, children: [jsxRuntime.jsx("label", { htmlFor: "tablev2-page-size", className: styles$4.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsxRuntime.jsx("select", { id: "tablev2-page-size", value: pageSize, onChange: handlePageSizeChange, className: styles$4.tablePaginationSelectInput, children: (footer.pageSizeOptions ?? [10, 25, 50, 100]).map((opt) => (jsxRuntime.jsx("option", { value: opt, children: opt }, opt))) })] }), jsxRuntime.jsx("div", { className: styles$4.tablePaginationInfo, children: jsxRuntime.jsx("span", { children: totalPages > 0
|
|
5550
5823
|
? `${pageIndex + 1} de ${totalPages}`
|
|
5551
5824
|
: '0 páginas' }) }), jsxRuntime.jsxs("div", { className: styles$4.tablePaginationControls, children: [jsxRuntime.jsx("button", { className: styles$4.tablePaginationButton, onClick: () => {
|
|
@@ -5561,7 +5834,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5561
5834
|
|
|
5562
5835
|
var styles$3 = {"container":"TextArea-module__container___WEBC-","inputWrapper":"TextArea-module__inputWrapper___-omPx","inputContainer":"TextArea-module__inputContainer___0-jKY","footer":"TextArea-module__footer___7XMlj","helperText":"TextArea-module__helperText___709rD","charCount":"TextArea-module__charCount___zdbxM","error":"TextArea-module__error___DWDms","disabled":"TextArea-module__disabled___lHxCa"};
|
|
5563
5836
|
|
|
5564
|
-
const TextArea =
|
|
5837
|
+
const TextArea = ({ ref, className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', charCount = false, height, virtualKeyboard, ...rest }) => {
|
|
5565
5838
|
const normalizeValue = (val) => {
|
|
5566
5839
|
return val === undefined || val === null ? '' : String(val);
|
|
5567
5840
|
};
|
|
@@ -5593,20 +5866,20 @@ const TextArea = React.forwardRef(({ className, value, label, placeholder, onCha
|
|
|
5593
5866
|
onFocus?.(e);
|
|
5594
5867
|
}, [onFocus]);
|
|
5595
5868
|
const hasError = Boolean(textareaError) || Boolean(error);
|
|
5596
|
-
const displayHelperText = (error ? errorMessage : undefined) || textareaError || helperText
|
|
5869
|
+
const displayHelperText = (error ? errorMessage : undefined) || textareaError || helperText;
|
|
5597
5870
|
const helperId = (textareaError || error)
|
|
5598
5871
|
? `${componentId}-error`
|
|
5599
5872
|
: helperText
|
|
5600
5873
|
? `${componentId}-helper`
|
|
5601
5874
|
: undefined;
|
|
5602
5875
|
const containerClass = clsx(styles$3.container, disabled && styles$3.disabled, hasError && !disabled && styles$3.error, className);
|
|
5603
|
-
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip:
|
|
5876
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: !!tooltipText, tooltipText: tooltipText, side: tooltipSide, align: tooltipAlign, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$3.inputWrapper, children: [jsxRuntime.jsx("div", { className: styles$3.inputContainer, children: jsxRuntime.jsx("textarea", { ...rest, ref: setTextareaRefs, id: componentId, name: name, value: textareaValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId, style: { resize, height }, inputMode: (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') ? 'none' : rest.inputMode }) }), (((error && errorMessage) || textareaError || helperText) || (charCount && maxLength)) && (jsxRuntime.jsxs("div", { className: styles$3.footer, children: [((error && errorMessage) || textareaError || helperText) && (jsxRuntime.jsx("span", { id: helperId, className: styles$3.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText })), charCount && maxLength && (jsxRuntime.jsxs("span", { className: styles$3.charCount, children: [textareaValue.length, "/", maxLength] }))] }))] }), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsxRuntime.jsx("div", { className: "virtualKeyboardWrapper", children: jsxRuntime.jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, maxLength: maxLength, value: textareaValue, targetRef: textareaRef, onChange: (val) => {
|
|
5604
5877
|
if (!disabled && (!maxLength || val.length <= maxLength)) {
|
|
5605
5878
|
setTextareaValue(val);
|
|
5606
5879
|
onChange?.(val);
|
|
5607
5880
|
}
|
|
5608
5881
|
} }) }))] }));
|
|
5609
|
-
}
|
|
5882
|
+
};
|
|
5610
5883
|
TextArea.displayName = 'TextArea';
|
|
5611
5884
|
var TextArea_default = React.memo(TextArea);
|
|
5612
5885
|
|