@giro-ds/react 11.2.0 → 12.1.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 +623 -469
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +388 -224
- package/dist/index.esm.js +625 -469
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +5 -5
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Avatar as Avatar$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Popover as Popover$1, Label, AlertDialog,
|
|
3
|
+
import { Avatar as Avatar$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Popover as Popover$1, Label, AlertDialog, DropdownMenu, Dialog as Dialog$1, RadioGroup, Select as Select$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, Toast as Toast$1, Switch as Switch$1, unstable_OneTimePasswordField } from 'radix-ui';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import React__default, { useId, useMemo, createContext, useState, useContext, useRef, useCallback, useEffect, useLayoutEffect, createElement,
|
|
5
|
+
import React__default, { useId, useMemo, createContext, useState, useContext, useRef, useCallback, useEffect, useLayoutEffect, createElement, memo, useReducer } from 'react';
|
|
6
6
|
import { SpinnerIos16Regular, ChevronUp16Regular, ChevronLeft16Regular, ChevronRight16Regular, ChevronDown16Regular, Dismiss24Regular, Emoji20Regular, ChevronDown20Regular, KeyboardShiftUppercase20Regular, KeyboardShift20Filled, KeyboardShift20Regular, Backspace20Regular, Info12Regular, Dismiss16Regular, Calendar16Regular, DocumentAdd24Regular, Warning24Regular, Document24Regular, FilterRegular, Search16Regular, ChevronDownRegular, ChevronRight16Filled, Subtract16Regular, Add16Regular, SearchInfo20Regular, ArrowSortUp16Regular, ArrowSortDown16Regular, ArrowSort16Regular, Info20Filled, CheckmarkCircle20Filled, Warning20Filled, Dismiss16Filled } from '@fluentui/react-icons';
|
|
7
7
|
import { DayPicker } from 'react-day-picker';
|
|
8
8
|
import { format, addDays, addMonths, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarMonths, eachMonthOfInterval, eachYearOfInterval, endOfISOWeek, endOfMonth, endOfWeek, endOfYear, getISOWeek, getMonth, getYear, getWeek, isAfter, isBefore, isDate, isSameDay, isSameMonth, isSameYear, max, min, setMonth, setYear, startOfDay, startOfISOWeek, startOfMonth, startOfWeek, startOfYear } from 'date-fns';
|
|
@@ -14,12 +14,13 @@ import Skeleton from 'react-loading-skeleton';
|
|
|
14
14
|
|
|
15
15
|
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"};
|
|
16
16
|
|
|
17
|
-
const Avatar = ({ icon, size = 'lg', src, className,
|
|
17
|
+
const Avatar = ({ icon, size = 'lg', src, className, text, ...rest }) => {
|
|
18
18
|
const AvatarClass = clsx(styles$v.AvatarRoot, {
|
|
19
19
|
[styles$v['AvatarRoot--lg']]: size === 'lg',
|
|
20
20
|
[styles$v['AvatarRoot--sm']]: size === 'sm',
|
|
21
21
|
}, className);
|
|
22
|
-
|
|
22
|
+
const truncatedText = text ? text.slice(0, 2) : undefined;
|
|
23
|
+
return (jsxs(Avatar$1.Root, { className: AvatarClass, ...rest, children: [src && (jsx(Avatar$1.Image, { className: styles$v.AvatarImage, src: src, alt: "Avatar" })), jsx(Avatar$1.Fallback, { className: styles$v.AvatarFallback, children: icon || truncatedText })] }));
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
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"};
|
|
@@ -64,7 +65,7 @@ const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, s
|
|
|
64
65
|
|
|
65
66
|
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"};
|
|
66
67
|
|
|
67
|
-
const Button =
|
|
68
|
+
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 }) => {
|
|
68
69
|
const generatedId = useId();
|
|
69
70
|
const componentId = id || generatedId;
|
|
70
71
|
const getComponent = () => {
|
|
@@ -180,7 +181,7 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
180
181
|
return (jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }) }));
|
|
181
182
|
}
|
|
182
183
|
return (jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }));
|
|
183
|
-
}
|
|
184
|
+
};
|
|
184
185
|
Button.displayName = 'Button';
|
|
185
186
|
|
|
186
187
|
function buildFormatLongFn(args) {
|
|
@@ -1357,30 +1358,42 @@ const offsetFormatCache = {};
|
|
|
1357
1358
|
const offsetCache = {};
|
|
1358
1359
|
|
|
1359
1360
|
/**
|
|
1360
|
-
* The function
|
|
1361
|
+
* The function returns UTC offset in minutes for the given date in specified
|
|
1361
1362
|
* time zone.
|
|
1362
1363
|
*
|
|
1363
1364
|
* Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
|
|
1364
1365
|
* mirrored to the sign of the offset in the time zone. For Asia/Singapore
|
|
1365
|
-
* (UTC+8), `tzOffset` returns 480
|
|
1366
|
+
* (UTC+8), `tzOffset` returns `480`, while `getTimezoneOffset` returns `-480`.
|
|
1366
1367
|
*
|
|
1367
|
-
*
|
|
1368
|
-
*
|
|
1368
|
+
* It uses `Intl.DateTimeFormat` internally to access otherwise unavailable
|
|
1369
|
+
* runtime's time zone data, and falls back to basic manual parsing if Intl API
|
|
1370
|
+
* is not supported (e.g., older Node.js versions, React Native's Hermes, etc.).
|
|
1369
1371
|
*
|
|
1370
|
-
* @
|
|
1372
|
+
* @param timeZone - Time zone name (IANA or UTC offset).
|
|
1373
|
+
* @param date - Date to check the offset for.
|
|
1374
|
+
*
|
|
1375
|
+
* @returns UTC offset in minutes (e.g., `480` for date in UTC+8).
|
|
1371
1376
|
*/
|
|
1372
1377
|
function tzOffset(timeZone, date) {
|
|
1373
1378
|
try {
|
|
1379
|
+
// Create `Intl.DateTimeFormat` with `"longOffset"` that gives us consistent
|
|
1380
|
+
// date strings like `"5/19/2026, GMT-08:00"`.
|
|
1374
1381
|
const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
|
|
1375
1382
|
timeZone,
|
|
1376
1383
|
timeZoneName: "longOffset"
|
|
1377
1384
|
}).format;
|
|
1385
|
+
|
|
1386
|
+
// Get `"-08:00"`.
|
|
1378
1387
|
const offsetStr = format(date).split("GMT")[1];
|
|
1388
|
+
|
|
1389
|
+
// Avoid parsing the same offset string.
|
|
1379
1390
|
if (offsetStr in offsetCache) return offsetCache[offsetStr];
|
|
1391
|
+
|
|
1392
|
+
// Calculate offset from `["-08", "00"]` and cache it.
|
|
1380
1393
|
return calcOffset(offsetStr, offsetStr.split(":"));
|
|
1381
1394
|
} catch {
|
|
1382
|
-
// Fallback to manual parsing if the runtime doesn't support
|
|
1383
|
-
// See: https://github.com/nodejs/node/issues/53419
|
|
1395
|
+
// Fallback to manual parsing if the runtime doesn't support
|
|
1396
|
+
// `±HH:MM/±HHMM/±HH`. See: https://github.com/nodejs/node/issues/53419.
|
|
1384
1397
|
if (timeZone in offsetCache) return offsetCache[timeZone];
|
|
1385
1398
|
const captures = timeZone?.match(offsetRe);
|
|
1386
1399
|
if (captures) return calcOffset(timeZone, captures.slice(1));
|
|
@@ -1396,30 +1409,69 @@ function calcOffset(cacheStr, values) {
|
|
|
1396
1409
|
return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
|
|
1397
1410
|
}
|
|
1398
1411
|
|
|
1412
|
+
// TZDate stores time in two `Date` objects because native `Date` can only
|
|
1413
|
+
// expose local fields in the system time zone.
|
|
1414
|
+
//
|
|
1415
|
+
// The external date (`this`) stores the real timestamp. It is the value used by
|
|
1416
|
+
// `getTime()`, `valueOf()`, UTC getters/setters, comparisons, and arithmetic.
|
|
1417
|
+
// Its local getters are not used for target-zone fields because they would read
|
|
1418
|
+
// the timestamp through the system time zone.
|
|
1419
|
+
//
|
|
1420
|
+
// The internal date (`this.internal`) stores the target-zone wall-clock fields.
|
|
1421
|
+
// We read and write those fields through UTC getters/setters so the host system
|
|
1422
|
+
// time zone cannot reinterpret them. For example, `getHours()` returns
|
|
1423
|
+
// `internal.getUTCHours()`, and `setHours()` writes `internal.setUTCHours(...)`.
|
|
1424
|
+
//
|
|
1425
|
+
// Syncing moves data between the two representations:
|
|
1426
|
+
//
|
|
1427
|
+
// - `syncToInternal` starts from the external timestamp and rebuilds internal
|
|
1428
|
+
// wall-clock fields using `this.timeZone` offset.
|
|
1429
|
+
//
|
|
1430
|
+
// - `syncFromInternal` starts from internal wall-clock fields, writes them into
|
|
1431
|
+
// the external date, then adjusts that timestamp for the system/target offset
|
|
1432
|
+
// difference and DST edge cases.
|
|
1433
|
+
//
|
|
1434
|
+
// The public TZDate value is the combination of both: external is the instant,
|
|
1435
|
+
// internal is the wall-clock view of that instant in `this.timeZone`.
|
|
1436
|
+
|
|
1399
1437
|
class TZDateMini extends Date {
|
|
1400
1438
|
//#region static
|
|
1401
1439
|
|
|
1402
1440
|
constructor(...args) {
|
|
1403
1441
|
super();
|
|
1442
|
+
|
|
1443
|
+
// Time zone string is always the last string argument unless date string
|
|
1444
|
+
// is passed (as a single argument).
|
|
1404
1445
|
if (args.length > 1 && typeof args[args.length - 1] === "string") {
|
|
1405
1446
|
this.timeZone = args.pop();
|
|
1406
1447
|
}
|
|
1407
1448
|
this.internal = new Date();
|
|
1449
|
+
|
|
1450
|
+
// Validate the time zone by checking its offset.
|
|
1408
1451
|
if (isNaN(tzOffset(this.timeZone, this))) {
|
|
1409
1452
|
this.setTime(NaN);
|
|
1410
1453
|
} else {
|
|
1411
1454
|
if (!args.length) {
|
|
1455
|
+
// No arguments passed: use current time
|
|
1412
1456
|
this.setTime(Date.now());
|
|
1413
1457
|
} else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) {
|
|
1458
|
+
// Timestamp passed: use it as is
|
|
1414
1459
|
this.setTime(args[0]);
|
|
1415
1460
|
} else if (typeof args[0] === "string") {
|
|
1461
|
+
// `Date` string passed: parse it as external date
|
|
1416
1462
|
this.setTime(+new Date(args[0]));
|
|
1417
1463
|
} else if (args[0] instanceof Date) {
|
|
1464
|
+
// `Date` passed: use its timestamp
|
|
1418
1465
|
this.setTime(+args[0]);
|
|
1419
1466
|
} else {
|
|
1467
|
+
// `Date` values passed:
|
|
1468
|
+
|
|
1469
|
+
// Set it as external date.
|
|
1420
1470
|
this.setTime(+new Date(...args));
|
|
1421
|
-
|
|
1422
|
-
|
|
1471
|
+
|
|
1472
|
+
// Adjust internal and external dates considering that we might have
|
|
1473
|
+
// landed on the DST hour.
|
|
1474
|
+
adjustToSystemTZ(this, args);
|
|
1423
1475
|
}
|
|
1424
1476
|
}
|
|
1425
1477
|
}
|
|
@@ -1436,8 +1488,8 @@ class TZDateMini extends Date {
|
|
|
1436
1488
|
}
|
|
1437
1489
|
getTimezoneOffset() {
|
|
1438
1490
|
const offset = -tzOffset(this.timeZone, this);
|
|
1439
|
-
// Remove the seconds offset
|
|
1440
|
-
//
|
|
1491
|
+
// Remove the seconds offset using `Math.floor` for negative UTC time zones
|
|
1492
|
+
// and `Math.ceil` for positive UTC time zones.
|
|
1441
1493
|
return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
|
|
1442
1494
|
}
|
|
1443
1495
|
|
|
@@ -1445,8 +1497,11 @@ class TZDateMini extends Date {
|
|
|
1445
1497
|
|
|
1446
1498
|
//#region time
|
|
1447
1499
|
|
|
1448
|
-
setTime(
|
|
1500
|
+
setTime(_time) {
|
|
1501
|
+
// Use the native `setTime` to the external date time.
|
|
1449
1502
|
Date.prototype.setTime.apply(this, arguments);
|
|
1503
|
+
|
|
1504
|
+
// Then apply it to the internal date adjusting to the timezone offset.
|
|
1450
1505
|
syncToInternal(this);
|
|
1451
1506
|
return +this;
|
|
1452
1507
|
}
|
|
@@ -1492,23 +1547,40 @@ Object.getOwnPropertyNames(Date.prototype).forEach(method => {
|
|
|
1492
1547
|
});
|
|
1493
1548
|
|
|
1494
1549
|
/**
|
|
1495
|
-
*
|
|
1550
|
+
* @internal
|
|
1551
|
+
* Function syncs time to internal date, applying the current time zone offset.
|
|
1496
1552
|
*
|
|
1497
|
-
* @param {Date} date - Date to sync
|
|
1553
|
+
* @param {Date} date - `Date` to sync
|
|
1498
1554
|
*/
|
|
1499
1555
|
function syncToInternal(date) {
|
|
1556
|
+
// Start internal from the same real timestamp as external.
|
|
1500
1557
|
date.internal.setTime(+date);
|
|
1501
|
-
|
|
1558
|
+
|
|
1559
|
+
// Shift internal by the target offset so its UTC fields become the target-zone
|
|
1560
|
+
// wall-clock fields for the external timestamp.
|
|
1561
|
+
//
|
|
1562
|
+
// o internal UTC fields: 2024-02-11 00:00
|
|
1563
|
+
// |
|
|
1564
|
+
// | + Asia/Singapore offset (+08:00)
|
|
1565
|
+
// v
|
|
1566
|
+
// x internal UTC fields: 2024-02-11 08:00
|
|
1567
|
+
//
|
|
1568
|
+
date.internal.setUTCSeconds(date.internal.getUTCSeconds() -
|
|
1569
|
+
// Round after converting minutes to seconds to avoid fractional offset
|
|
1570
|
+
// precision errors from historical offsets.
|
|
1571
|
+
Math.round(-tzOffset(date.timeZone, date) * 60));
|
|
1502
1572
|
}
|
|
1503
1573
|
|
|
1504
1574
|
/**
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
1575
|
+
* @internal
|
|
1576
|
+
* Function syncs internal wall-clock fields into the external date.
|
|
1507
1577
|
*
|
|
1508
1578
|
* @param {Date} date - The date to sync
|
|
1509
1579
|
*/
|
|
1510
1580
|
function syncFromInternal(date) {
|
|
1511
|
-
//
|
|
1581
|
+
// Copy target-zone wall-clock fields from internal into external using native
|
|
1582
|
+
// local setters. At this point external holds the right field values but they
|
|
1583
|
+
// are interpreted in the system time zone; `adjustToSystemTZ` fixes that.
|
|
1512
1584
|
Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
|
|
1513
1585
|
Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
|
|
1514
1586
|
|
|
@@ -1517,115 +1589,271 @@ function syncFromInternal(date) {
|
|
|
1517
1589
|
}
|
|
1518
1590
|
|
|
1519
1591
|
/**
|
|
1592
|
+
* @internal
|
|
1520
1593
|
* Function adjusts the date to the system time zone. It uses the time zone
|
|
1521
1594
|
* differences to calculate the offset and adjust the date.
|
|
1522
1595
|
*
|
|
1523
|
-
*
|
|
1596
|
+
* We use it when constructing `TZDate` and syncing the external date from
|
|
1597
|
+
* the internal one.
|
|
1598
|
+
*
|
|
1599
|
+
* @param {TZDate} date - `TZDate` to adjust.
|
|
1524
1600
|
*/
|
|
1525
|
-
function adjustToSystemTZ(date) {
|
|
1526
|
-
//
|
|
1527
|
-
|
|
1528
|
-
//
|
|
1529
|
-
|
|
1530
|
-
|
|
1601
|
+
function adjustToSystemTZ(date, constructorArgs) {
|
|
1602
|
+
// Keep the intended target-zone wall-clock value before native Date/system
|
|
1603
|
+
// time zone normalization can move it. Later corrections compare against this
|
|
1604
|
+
// value to distinguish intended DST normalization from accidental drift.
|
|
1605
|
+
const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal;
|
|
1606
|
+
//#region Initial offset calculation
|
|
1607
|
+
|
|
1608
|
+
// Current target time zone offset at the native timestamp. It may include
|
|
1609
|
+
// historical offset seconds, which we preserve for the seconds adjustment.
|
|
1610
|
+
const offsetWithSeconds = tzOffset(date.timeZone, date);
|
|
1611
|
+
|
|
1612
|
+
// Minute-precision target offset used by minute-based timestamp adjustments.
|
|
1613
|
+
// Historical offsets can contain seconds, so we strip the fractional minute
|
|
1614
|
+
// here and handle remaining seconds in the seconds adjustment below.
|
|
1615
|
+
const offset = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds);
|
|
1616
|
+
|
|
1617
|
+
//#endregion
|
|
1618
|
+
|
|
1531
1619
|
//#region System DST adjustment
|
|
1532
1620
|
|
|
1533
|
-
//
|
|
1534
|
-
//
|
|
1535
|
-
// up on the DST hour:
|
|
1536
|
-
//
|
|
1537
|
-
// $ TZ=America/New_York node
|
|
1538
|
-
// > new Date(2020, 2, 8, 1).toString()
|
|
1539
|
-
// 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'
|
|
1540
|
-
// > new Date(2020, 2, 8, 2).toString()
|
|
1541
|
-
// 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
1542
|
-
// > new Date(2020, 2, 8, 3).toString()
|
|
1543
|
-
// 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
1544
|
-
// > new Date(2020, 2, 8, 4).toString()
|
|
1545
|
-
// 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'
|
|
1621
|
+
// Native `Date` may normalize the requested wall time when the system time
|
|
1622
|
+
// zone skips that hour for DST.
|
|
1546
1623
|
//
|
|
1547
|
-
//
|
|
1548
|
-
//
|
|
1549
|
-
//
|
|
1550
|
-
//
|
|
1551
|
-
// However we want to adjust only if that's the DST hour the change happenes,
|
|
1552
|
-
// not the hour where DST moves to.
|
|
1624
|
+
// We compare the system wall-clock hour represented by the external date with
|
|
1625
|
+
// the wall-clock hour stored in the internal date. If they differ, the next
|
|
1626
|
+
// offset-diff calculation may need the previous system offset, because the
|
|
1627
|
+
// current external timestamp is already after the system DST jump.
|
|
1553
1628
|
|
|
1554
|
-
//
|
|
1555
|
-
//
|
|
1629
|
+
// Previous-hour reference used to detect whether the system offset changed
|
|
1630
|
+
// immediately before the current native timestamp.
|
|
1556
1631
|
const prevHour = new Date(+date);
|
|
1557
|
-
|
|
1558
|
-
//
|
|
1632
|
+
|
|
1633
|
+
// Use UTC math so subtracting one hour cannot be normalized back into the
|
|
1634
|
+
// same missing local DST hour.
|
|
1559
1635
|
prevHour.setUTCHours(prevHour.getUTCHours() - 1);
|
|
1560
1636
|
|
|
1561
|
-
//
|
|
1637
|
+
// Current system offset at the native timestamp.
|
|
1562
1638
|
const systemOffset = -new Date(+date).getTimezoneOffset();
|
|
1639
|
+
|
|
1640
|
+
// System offset one real hour before the native timestamp.
|
|
1563
1641
|
const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
|
|
1642
|
+
|
|
1643
|
+
// Non-zero when the system offset changed between `prevHour` and `date`.
|
|
1564
1644
|
const systemDSTChange = systemOffset - prevHourSystemOffset;
|
|
1565
|
-
// Detect the DST shift. System DST change will occur both on
|
|
1566
|
-
const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
|
|
1567
1645
|
|
|
1568
|
-
//
|
|
1569
|
-
|
|
1646
|
+
// System offset to use in the later system-target offset difference.
|
|
1647
|
+
// Defaults to the current system offset and switches to the previous offset
|
|
1648
|
+
// only when native `Date` normalized a missing system wall time.
|
|
1649
|
+
let systemOffsetForDiff = systemOffset;
|
|
1650
|
+
if (systemDSTChange && systemOffset !== offset) {
|
|
1651
|
+
// System wall-clock hour represented by the current external timestamp.
|
|
1652
|
+
const systemHour = Date.prototype.getHours.apply(date);
|
|
1653
|
+
|
|
1654
|
+
// Target wall-clock hour currently stored in internal fields. Constructors
|
|
1655
|
+
// get it from arguments because internal may have already been synced from
|
|
1656
|
+
// the normalized external timestamp; setters get it directly from internal.
|
|
1657
|
+
const expectedHour = Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours();
|
|
1658
|
+
if (systemHour !== expectedHour) {
|
|
1659
|
+
// Check whether using the current system offset would keep the target
|
|
1660
|
+
// offset unchanged. If so, the only DST jump we crossed is the system
|
|
1661
|
+
// one, so the diff should use the pre-DST system offset.
|
|
1662
|
+
const testDate = new Date(+date);
|
|
1663
|
+
|
|
1664
|
+
// Difference that the later offset-diff step would apply with the
|
|
1665
|
+
// current system offset.
|
|
1666
|
+
const testOffsetDiff = systemOffset - offset;
|
|
1667
|
+
if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff);
|
|
1668
|
+
|
|
1669
|
+
// Target offset after applying the current system offset difference.
|
|
1670
|
+
const testOffsetWithSeconds = tzOffset(date.timeZone, testDate);
|
|
1671
|
+
|
|
1672
|
+
// Target offset without historical seconds, matching `offset`.
|
|
1673
|
+
const testOffset = testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds);
|
|
1674
|
+
if (testOffset === offset) systemOffsetForDiff = prevHourSystemOffset;
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1570
1677
|
|
|
1571
1678
|
//#endregion
|
|
1572
1679
|
|
|
1573
1680
|
//#region System diff adjustment
|
|
1574
1681
|
|
|
1575
|
-
//
|
|
1576
|
-
//
|
|
1577
|
-
//
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1682
|
+
// Move external from the system-zone interpretation of internal fields toward
|
|
1683
|
+
// the timestamp that represents those fields in the target time zone.
|
|
1684
|
+
//
|
|
1685
|
+
// At this point native `Date` has treated the internal wall-clock fields as if
|
|
1686
|
+
// they belonged to the system zone. The system-target offset difference moves
|
|
1687
|
+
// external by the distance between that system interpretation and the target
|
|
1688
|
+
// interpretation.
|
|
1689
|
+
|
|
1690
|
+
// Difference between the system offset selected above and the minute-precision
|
|
1691
|
+
// target offset. Positive values move external forward; negative values move
|
|
1692
|
+
// it backward.
|
|
1693
|
+
const offsetDiff = systemOffsetForDiff - offset;
|
|
1694
|
+
if (offsetDiff)
|
|
1695
|
+
// Apply the system-target minute difference to external. Internal is
|
|
1696
|
+
// rebuilt from the final external timestamp after all adjustments are
|
|
1697
|
+
// complete.
|
|
1698
|
+
//
|
|
1699
|
+
// o external as target: 2023-01-31 23:00
|
|
1700
|
+
// |
|
|
1701
|
+
// | add `offsetDiff`
|
|
1702
|
+
// v
|
|
1703
|
+
// x external as target: 2023-02-01 12:00
|
|
1704
|
+
//
|
|
1705
|
+
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
|
|
1581
1706
|
|
|
1582
1707
|
//#endregion
|
|
1583
1708
|
|
|
1584
|
-
//#region Seconds
|
|
1709
|
+
//#region Seconds system diff adjustment
|
|
1710
|
+
|
|
1711
|
+
// Historical time zone offsets can include seconds, but the minute-based
|
|
1712
|
+
// offset adjustment above intentionally used minute precision.
|
|
1713
|
+
//
|
|
1714
|
+
// This adjustment applies the remaining seconds difference to external. For
|
|
1715
|
+
// example, historical Singapore used UTC+06:55:25, while ISO formatting shows
|
|
1716
|
+
// only `+06:55`; without the seconds correction, setter paths keep the wrong
|
|
1717
|
+
// wall-clock seconds.
|
|
1585
1718
|
|
|
1719
|
+
// Clone external as a native `Date` so we can inspect how the system time zone
|
|
1720
|
+
// represents the same timestamp.
|
|
1586
1721
|
const systemDate = new Date(+date);
|
|
1587
|
-
|
|
1722
|
+
|
|
1723
|
+
// Zero UTC seconds before reading system seconds. Any remaining local seconds
|
|
1724
|
+
// then come from the system time zone offset rather than from the timestamp's
|
|
1725
|
+
// own seconds value.
|
|
1588
1726
|
systemDate.setUTCSeconds(0);
|
|
1589
|
-
|
|
1727
|
+
|
|
1728
|
+
// Seconds part contributed by the system time zone offset. Negative offsets
|
|
1729
|
+
// need wrapping because `Date#getSeconds()` returns values in the 0..59 range.
|
|
1590
1730
|
const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
|
|
1591
1731
|
|
|
1592
|
-
//
|
|
1732
|
+
// Seconds part contributed by the target time zone offset.
|
|
1593
1733
|
const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
|
|
1594
|
-
if (secondsOffset || systemSecondsOffset)
|
|
1595
|
-
|
|
1734
|
+
if (secondsOffset || systemSecondsOffset)
|
|
1735
|
+
// Apply the remaining second-level system-target difference to external.
|
|
1736
|
+
//
|
|
1737
|
+
// o external as Asia/Singapore: 1900-01-01 00:00:56
|
|
1738
|
+
// |
|
|
1739
|
+
// | + `secondsOffset`
|
|
1740
|
+
// | + `systemSecondsOffset`
|
|
1741
|
+
// v
|
|
1742
|
+
// x external as Asia/Singapore: 1900-01-01 00:00:31
|
|
1743
|
+
//
|
|
1596
1744
|
Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
|
|
1597
|
-
}
|
|
1598
1745
|
|
|
1599
1746
|
//#endregion
|
|
1600
1747
|
|
|
1601
1748
|
//#region Post-adjustment DST fix
|
|
1602
1749
|
|
|
1603
|
-
|
|
1604
|
-
//
|
|
1605
|
-
//
|
|
1606
|
-
|
|
1750
|
+
// The first system-target offset move can cross a target-zone DST boundary.
|
|
1751
|
+
//
|
|
1752
|
+
// When that happens, the target offset at the new external timestamp differs
|
|
1753
|
+
// from the target offset used for `offsetDiff`. We compare the original move
|
|
1754
|
+
// with the move that would be calculated at the new timestamp, then apply the
|
|
1755
|
+
// difference to external.
|
|
1756
|
+
|
|
1757
|
+
// Target offset at the current external timestamp, including historical
|
|
1758
|
+
// seconds for the later seconds adjustment.
|
|
1759
|
+
const postOffsetWithSeconds = tzOffset(date.timeZone, date);
|
|
1760
|
+
|
|
1761
|
+
// Minute-precision target offset at the current external timestamp.
|
|
1762
|
+
const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds);
|
|
1763
|
+
|
|
1764
|
+
// System offset at the current external timestamp.
|
|
1607
1765
|
const postSystemOffset = -new Date(+date).getTimezoneOffset();
|
|
1766
|
+
|
|
1767
|
+
// System-target offset difference at the current external timestamp.
|
|
1608
1768
|
const postOffsetDiff = postSystemOffset - postOffset;
|
|
1769
|
+
|
|
1770
|
+
// Whether the target offset changed after the first offset move.
|
|
1609
1771
|
const offsetChanged = postOffset !== offset;
|
|
1772
|
+
|
|
1773
|
+
// Difference between the current offset move and the move already applied.
|
|
1610
1774
|
const postDiff = postOffsetDiff - offsetDiff;
|
|
1611
|
-
|
|
1775
|
+
|
|
1776
|
+
// If the first offset move already normalized a target DST gap forward, the
|
|
1777
|
+
// generic post-DST correction below would undo that valid normalization. This
|
|
1778
|
+
// happens, for example, with America/New_York 02:00 during spring-forward when
|
|
1779
|
+
// the system zone also changes offset around the same instant.
|
|
1780
|
+
const targetDSTShift = postOffset - offset;
|
|
1781
|
+
|
|
1782
|
+
// Candidate timestamp that would represent the requested wall-clock time with
|
|
1783
|
+
// the post-transition target offset. If it still does not round-trip to the
|
|
1784
|
+
// requested wall-clock fields, the requested time is inside a target DST gap.
|
|
1785
|
+
const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1000;
|
|
1786
|
+
|
|
1787
|
+
// Only positive target offset shifts are spring-forward gaps. Negative shifts
|
|
1788
|
+
// are fall-back overlaps and still need the regular post-adjustment path.
|
|
1789
|
+
const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1000 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime;
|
|
1790
|
+
if (offsetChanged && postDiff && !normalizedTargetDSTGap) {
|
|
1791
|
+
// Apply the target-DST correction to external. In the backward-crossing case
|
|
1792
|
+
// shown here, this lands on an intermediate value that needs `offsetChange`
|
|
1793
|
+
// below.
|
|
1794
|
+
//
|
|
1795
|
+
// o external as America/New_York: 2023-03-12 03:00 EDT
|
|
1796
|
+
// |
|
|
1797
|
+
// | + `postDiff`
|
|
1798
|
+
// v
|
|
1799
|
+
// x external as America/New_York: 2023-03-12 01:00 EST
|
|
1800
|
+
//
|
|
1612
1801
|
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
|
|
1613
1802
|
|
|
1614
|
-
//
|
|
1615
|
-
//
|
|
1803
|
+
// Target offset after applying `postDiff`. It may change again if the
|
|
1804
|
+
// correction itself crosses a target-zone DST boundary.
|
|
1805
|
+
const newOffsetWithSeconds = tzOffset(date.timeZone, date);
|
|
1616
1806
|
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1807
|
+
// Minute-precision target offset after applying `postDiff`.
|
|
1808
|
+
const newOffset = newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds);
|
|
1809
|
+
|
|
1810
|
+
// Offset change caused by the `postDiff` move itself.
|
|
1621
1811
|
const offsetChange = postOffset - newOffset;
|
|
1622
|
-
|
|
1623
|
-
|
|
1812
|
+
|
|
1813
|
+
// If the correction moved external backward across the target DST boundary,
|
|
1814
|
+
// apply the boundary change so external lands on the valid target-zone
|
|
1815
|
+
// timestamp. Forward crossings are already normalized by native Date, and
|
|
1816
|
+
// applying this correction there would undo the valid post-DST result.
|
|
1817
|
+
if (offsetChange && postDiff < 0) {
|
|
1818
|
+
// Apply the second target-DST correction to external.
|
|
1819
|
+
//
|
|
1820
|
+
// o external as America/New_York: 2023-03-12 01:00 EST
|
|
1821
|
+
// |
|
|
1822
|
+
// | + `offsetChange`
|
|
1823
|
+
// v
|
|
1824
|
+
// x external as America/New_York: 2023-03-12 03:00 EDT
|
|
1825
|
+
//
|
|
1624
1826
|
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
|
|
1625
1827
|
}
|
|
1626
1828
|
}
|
|
1627
1829
|
|
|
1628
1830
|
//#endregion
|
|
1831
|
+
|
|
1832
|
+
// Rebuild internal wall-clock fields from the final external timestamp.
|
|
1833
|
+
syncToInternal(date);
|
|
1834
|
+
|
|
1835
|
+
// Native Date can normalize historical system offsets with minute and second
|
|
1836
|
+
// precision before we adjust to the target time zone. Correct only small
|
|
1837
|
+
// historical drift so DST gap normalization (usually one hour) remains intact.
|
|
1838
|
+
const expectedTime = constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1000;
|
|
1839
|
+
const drift = expectedTime - +date.internal;
|
|
1840
|
+
if (drift && Math.abs(drift) < 30 * 60 * 1000) {
|
|
1841
|
+
Date.prototype.setTime.call(date, +date + drift);
|
|
1842
|
+
syncToInternal(date);
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
function constructorArgsToInternalTime(args) {
|
|
1846
|
+
// Mirror Date's date-value constructor defaults while preserving explicit
|
|
1847
|
+
// `undefined` behavior. Missing month/day default, but passed `undefined`
|
|
1848
|
+
// should remain invalid just like `Date.UTC(year, undefined, ...)`.
|
|
1849
|
+
return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3));
|
|
1850
|
+
}
|
|
1851
|
+
function targetInternalTime(date, time) {
|
|
1852
|
+
// Compute the target-zone wall-clock representation for a timestamp without
|
|
1853
|
+
// mutating the TZDate. This mirrors syncToInternal for temporary checks.
|
|
1854
|
+
const internal = new Date(time ?? +date);
|
|
1855
|
+
internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60));
|
|
1856
|
+
return +internal;
|
|
1629
1857
|
}
|
|
1630
1858
|
|
|
1631
1859
|
class TZDate extends TZDateMini {
|
|
@@ -2439,7 +2667,7 @@ const ptBR = {
|
|
|
2439
2667
|
},
|
|
2440
2668
|
};
|
|
2441
2669
|
|
|
2442
|
-
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","
|
|
2670
|
+
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"};
|
|
2443
2671
|
|
|
2444
2672
|
const FLUENT_CHEVRON_MAP = {
|
|
2445
2673
|
down: ChevronDown16Regular,
|
|
@@ -2461,15 +2689,19 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2461
2689
|
return (jsxs("div", { ...divProps, children: [jsx("span", { className: styles$r.caption_grid_label, children: monthLabel }), jsxs("button", { type: "button", className: styles$r.caption_grid_btn, "aria-pressed": view === "years", onClick: onYearLabelClick, children: [yearLabel, view !== "days" ? (jsx("span", { className: styles$r.chevron_wrapper, children: jsx(ChevronUp16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) })) : (jsx("span", { className: styles$r.chevron_wrapper, children: jsx(ChevronDown16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) }))] })] }));
|
|
2462
2690
|
};
|
|
2463
2691
|
const YEARS_PER_PAGE = 20;
|
|
2464
|
-
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear
|
|
2692
|
+
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 }) => {
|
|
2465
2693
|
const animate = true;
|
|
2466
2694
|
const [internalSelected, setInternalSelected] = useState(selected ?? undefined);
|
|
2695
|
+
const [internalRange, setInternalRange] = useState(selectedRange ?? undefined);
|
|
2467
2696
|
const [internalDisplayMonth, setInternalDisplayMonth] = useState(() => currentDate ?? defaultMonth ?? new Date());
|
|
2468
2697
|
const [gridView, setGridView] = useState("days");
|
|
2469
2698
|
const [yearPageStart, setYearPageStart] = useState(() => (currentDate ?? defaultMonth ?? new Date()).getFullYear() - 9);
|
|
2470
2699
|
const resolvedSelected = selected !== undefined
|
|
2471
2700
|
? (selected ?? undefined)
|
|
2472
2701
|
: internalSelected;
|
|
2702
|
+
const resolvedRange = selectedRange !== undefined
|
|
2703
|
+
? (selectedRange ?? undefined)
|
|
2704
|
+
: internalRange;
|
|
2473
2705
|
const resolvedLocale = locale === "pt-br" ? ptBR : enUS;
|
|
2474
2706
|
const intlLocale = locale === "pt-br" ? "pt-BR" : "en-US";
|
|
2475
2707
|
const disabledMatchers = [
|
|
@@ -2482,6 +2714,33 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2482
2714
|
if (date) {
|
|
2483
2715
|
onDaySelect?.(date);
|
|
2484
2716
|
}
|
|
2717
|
+
else {
|
|
2718
|
+
onClear?.();
|
|
2719
|
+
}
|
|
2720
|
+
};
|
|
2721
|
+
const handleRangeSelect = (range, selectedDay) => {
|
|
2722
|
+
const current = resolvedRange;
|
|
2723
|
+
// Desselecionar: apenas um dia marcado (to ausente ou to = from) e o usuário clicou nele
|
|
2724
|
+
const isSingleDaySelected = current?.from != null &&
|
|
2725
|
+
(current.to == null || current.from.getTime() === current.to.getTime());
|
|
2726
|
+
if (isSingleDaySelected && current?.from?.getTime() === selectedDay.getTime()) {
|
|
2727
|
+
setInternalRange(undefined);
|
|
2728
|
+
onRangeSelect?.(undefined);
|
|
2729
|
+
onClear?.();
|
|
2730
|
+
return;
|
|
2731
|
+
}
|
|
2732
|
+
// Range completo (from ≠ to): reinicia a seleção com o dia clicado
|
|
2733
|
+
const isComplete = current?.from != null &&
|
|
2734
|
+
current?.to != null &&
|
|
2735
|
+
current.from.getTime() !== current.to.getTime();
|
|
2736
|
+
if (isComplete) {
|
|
2737
|
+
const fresh = { from: selectedDay, to: undefined };
|
|
2738
|
+
setInternalRange(fresh);
|
|
2739
|
+
onRangeSelect?.(fresh);
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
setInternalRange(range);
|
|
2743
|
+
onRangeSelect?.(range);
|
|
2485
2744
|
};
|
|
2486
2745
|
const handleMonthChange = (date) => {
|
|
2487
2746
|
setInternalDisplayMonth(date);
|
|
@@ -2528,18 +2787,20 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2528
2787
|
const sharedDayPickerProps = {
|
|
2529
2788
|
classNames: styles$r,
|
|
2530
2789
|
animate,
|
|
2531
|
-
mode: "single",
|
|
2532
|
-
selected: resolvedSelected,
|
|
2533
|
-
onSelect: handleSelect,
|
|
2534
2790
|
startMonth,
|
|
2535
2791
|
endMonth,
|
|
2536
2792
|
disabled: disabledMatchers.length > 0 ? disabledMatchers : undefined,
|
|
2537
2793
|
locale: resolvedLocale,
|
|
2538
2794
|
autoFocus,
|
|
2539
2795
|
"aria-label": ariaLabel,
|
|
2796
|
+
captionLayout: "label",
|
|
2797
|
+
numberOfMonths,
|
|
2798
|
+
month: resolvedDisplayMonth,
|
|
2799
|
+
onMonthChange: handleMonthChange,
|
|
2800
|
+
components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron },
|
|
2540
2801
|
};
|
|
2541
2802
|
const containerStyle = { '--giro-scale': scale };
|
|
2542
|
-
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: clsx(styles$r.calendar_grid_wrapper, className), style: { ...containerStyle, ...style }, children: [jsx(DayPicker, { id: id, ...sharedDayPickerProps, ...rest,
|
|
2803
|
+
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: clsx(styles$r.calendar_grid_wrapper, className), style: { ...containerStyle, ...style }, children: [mode === "range" ? (jsx(DayPicker, { id: id, ...sharedDayPickerProps, ...rest, mode: "range", selected: resolvedRange, onSelect: handleRangeSelect })) : (jsx(DayPicker, { id: id, ...sharedDayPickerProps, ...rest, mode: "single", selected: resolvedSelected, onSelect: handleSelect })), gridView !== "days" && (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" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$r.gridOverlayCaption, children: [jsx("span", { className: styles$r.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$r.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsx("span", { className: styles$r.chevron_wrapper, children: jsx(ChevronUp16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) })] })] }), jsx("div", { className: styles$r.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$r.gridCell}${displayedMonthIndex === index ? ` ${styles$r.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$r.gridOverlayCaption, children: [jsx("span", { className: styles$r.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$r.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsx("span", { className: styles$r.chevron_wrapper, children: jsx(ChevronUp16Regular, { className: styles$r.caption_year_chevron, "aria-hidden": true }) })] }), jsxs("div", { className: styles$r.gridOverlayYearsNav, children: [jsx("button", { type: "button", className: styles$r.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsx("span", { className: styles$r.chevron_wrapper, children: jsx(ChevronLeft16Regular, { className: styles$r.chevronNavBtnPrev, "aria-hidden": true }) }) }), jsx("button", { type: "button", className: styles$r.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsx("span", { className: styles$r.chevron_wrapper, children: jsx(ChevronRight16Regular, { className: styles$r.chevronNavBtnNext, "aria-hidden": true }) }) })] })] }), jsx("div", { className: `${styles$r.gridCells} ${styles$r.gridCellsYears}`, children: yearsInPage.map((year) => (jsx("button", { type: "button", className: `${styles$r.gridCell}${displayedYear === year ? ` ${styles$r.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2543
2804
|
};
|
|
2544
2805
|
|
|
2545
2806
|
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"};
|
|
@@ -2599,7 +2860,15 @@ const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled =
|
|
|
2599
2860
|
...style,
|
|
2600
2861
|
};
|
|
2601
2862
|
const isInteractive = typeof rest.onClick === 'function';
|
|
2602
|
-
|
|
2863
|
+
const { onKeyDown: userOnKeyDown, ...otherRest } = rest;
|
|
2864
|
+
const handleKeyDown = (e) => {
|
|
2865
|
+
userOnKeyDown?.(e);
|
|
2866
|
+
if (!e.defaultPrevented && isInteractive && !disabled && (e.key === 'Enter' || e.key === ' ')) {
|
|
2867
|
+
e.preventDefault();
|
|
2868
|
+
rest.onClick?.(e);
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
return (jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, onKeyDown: handleKeyDown, ...otherRest, children: [leftIcon && (jsx("span", { className: styles$n.iconLeft, "aria-hidden": "true", children: leftIcon })), jsx("span", { className: styles$n.title, children: children }), rightIcon && (jsx("span", { className: styles$n.iconRight, "aria-hidden": "true", children: rightIcon }))] }));
|
|
2603
2872
|
};
|
|
2604
2873
|
const MemoizedChips = React__default.memo(Chips);
|
|
2605
2874
|
MemoizedChips.displayName = 'Chips';
|
|
@@ -2610,10 +2879,10 @@ function Container({ children, className }) {
|
|
|
2610
2879
|
return (jsx("main", { className: clsx(styles$m['container'], 'mx-auto', className), children: children }));
|
|
2611
2880
|
}
|
|
2612
2881
|
|
|
2613
|
-
var styles$l = {"Content":"Popover-module__Content___RIETg"};
|
|
2882
|
+
var styles$l = {"Content":"Popover-module__Content___RIETg","Arrow":"Popover-module__Arrow___ue4Mg"};
|
|
2614
2883
|
|
|
2615
2884
|
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, className, ...rest }) => {
|
|
2616
|
-
return (jsxs(Popover$1.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsx(Popover$1.Anchor, { asChild: true, children: trigger })) : (jsx(Popover$1.Trigger, { asChild: true, children: trigger })), jsx(Popover$1.Portal, { children: jsxs(Popover$1.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 && jsx(Popover$1.Arrow, {})] }) })] }));
|
|
2885
|
+
return (jsxs(Popover$1.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsx(Popover$1.Anchor, { asChild: true, children: trigger })) : (jsx(Popover$1.Trigger, { asChild: true, children: trigger })), jsx(Popover$1.Portal, { children: jsxs(Popover$1.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 && jsx(Popover$1.Arrow, { className: styles$l.Arrow })] }) })] }));
|
|
2617
2886
|
};
|
|
2618
2887
|
|
|
2619
2888
|
function useInputKeyboardValue(externalRef) {
|
|
@@ -2812,7 +3081,7 @@ const ACCENT_OPTIONS = {
|
|
|
2812
3081
|
* <VirtualKeyboard targetRef={inputRef} value={value} onChange={setValue} />
|
|
2813
3082
|
* ```
|
|
2814
3083
|
*/
|
|
2815
|
-
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, onTypeChange, maxLength, Emoji = false, className, id,
|
|
3084
|
+
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, }) => {
|
|
2816
3085
|
const [layoutName, setLayoutName] = useState('default');
|
|
2817
3086
|
const [capsLockOn, setCapsLockOn] = useState(false);
|
|
2818
3087
|
const [accentMenu, setAccentMenu] = useState(null);
|
|
@@ -3327,7 +3596,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3327
3596
|
if (variant === 'native' && typeof document !== 'undefined') {
|
|
3328
3597
|
return createPortal(jsx("div", { id: id, className: clsx(styles$k.overlay, { [styles$k.overlayOpen]: isOpen }, styles$k[`layout--${visualType}`], className), children: keyboardEl }), document.body);
|
|
3329
3598
|
}
|
|
3330
|
-
return (jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsx("div", { className: styles$k.textFieldContainer, children: jsx(TextField$1, { placeholder:
|
|
3599
|
+
return (jsxs("div", { id: id, className: clsx(styles$k.container, styles$k[`mode--${variant}`], styles$k[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsx("div", { className: styles$k.textFieldContainer, children: jsx(TextField$1, { 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] }));
|
|
3331
3600
|
};
|
|
3332
3601
|
|
|
3333
3602
|
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"};
|
|
@@ -3356,7 +3625,7 @@ const LabelComponent = ({ children, htmlFor, required = false, tooltip = false,
|
|
|
3356
3625
|
return container;
|
|
3357
3626
|
};
|
|
3358
3627
|
|
|
3359
|
-
const TextField =
|
|
3628
|
+
const TextField = ({ 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 }) => {
|
|
3360
3629
|
const normalizeValue = (val) => {
|
|
3361
3630
|
return val === undefined || val === null ? '' : String(val);
|
|
3362
3631
|
};
|
|
@@ -3407,7 +3676,7 @@ const TextField = forwardRef(({ className, style, value, label, placeholder, typ
|
|
|
3407
3676
|
setIsFocused(true);
|
|
3408
3677
|
onFocus?.(e);
|
|
3409
3678
|
}, [onFocus]);
|
|
3410
|
-
const showCustomIcon = inputValue.trim().length === 0 && icon;
|
|
3679
|
+
const showCustomIcon = (inputValue.trim().length === 0 || persistIcon) && icon;
|
|
3411
3680
|
const showClearIcon = isFocused && inputValue.trim().length > 0;
|
|
3412
3681
|
const hasError = Boolean(inputError) || Boolean(error);
|
|
3413
3682
|
const displayHelperText = (error ? errorMessage : undefined) || inputError || helperText || '\u00A0';
|
|
@@ -3417,14 +3686,13 @@ const TextField = forwardRef(({ className, style, value, label, placeholder, typ
|
|
|
3417
3686
|
? `${componentId}-helper`
|
|
3418
3687
|
: undefined;
|
|
3419
3688
|
const containerStyle = { '--giro-scale': scale };
|
|
3420
|
-
const containerClass = clsx(styles$j.container, {
|
|
3689
|
+
const containerClass = clsx(styles$j.container, className, {
|
|
3421
3690
|
[styles$j.attachedToVirtualKeyboard]: attachedToVirtualKeyboard,
|
|
3422
3691
|
[styles$j.disabled]: disabled,
|
|
3423
3692
|
[styles$j.error]: error,
|
|
3424
3693
|
[styles$j.errorWithMessage]: !!errorMessage,
|
|
3425
|
-
[className]: className,
|
|
3426
3694
|
});
|
|
3427
|
-
return (jsxs("div", { className: containerClass, style: { ...containerStyle, ...style }, children: [label && (jsx(LabelComponent, { scale: scale, htmlFor: componentId, required: required, tooltip:
|
|
3695
|
+
return (jsxs("div", { className: containerClass, style: { ...containerStyle, ...style }, children: [label && (jsx(LabelComponent, { scale: scale, htmlFor: componentId, required: required, tooltip: !!tooltipText, tooltipText: tooltipText, side: tooltipSide, align: tooltipAlign, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$j.inputWrapper, children: [jsxs("div", { className: styles$j.inputContainer, children: [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({
|
|
3428
3696
|
[styles$j.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
3429
3697
|
}) }), showCustomIcon && jsx("span", { className: styles$j.icon, children: icon }), showClearIcon && (jsx("button", { type: "button", className: styles$j.clearButton, onMouseDown: (e) => {
|
|
3430
3698
|
e.preventDefault();
|
|
@@ -3435,7 +3703,7 @@ const TextField = forwardRef(({ className, style, value, label, placeholder, typ
|
|
|
3435
3703
|
onChange?.(val);
|
|
3436
3704
|
}
|
|
3437
3705
|
} }) }))] }));
|
|
3438
|
-
}
|
|
3706
|
+
};
|
|
3439
3707
|
TextField.displayName = 'TextField';
|
|
3440
3708
|
var TextField$1 = React__default.memo(TextField);
|
|
3441
3709
|
|
|
@@ -3765,7 +4033,7 @@ const matchesAccept = (file, accept) => {
|
|
|
3765
4033
|
return fileType === type;
|
|
3766
4034
|
});
|
|
3767
4035
|
};
|
|
3768
|
-
const FileUpload =
|
|
4036
|
+
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 }) => {
|
|
3769
4037
|
const generatedId = useId();
|
|
3770
4038
|
const componentId = id || generatedId;
|
|
3771
4039
|
const helperId = `${componentId}-helper`;
|
|
@@ -3900,12 +4168,12 @@ const FileUpload = forwardRef(({ value, onChange, helperText, error = false, err
|
|
|
3900
4168
|
}
|
|
3901
4169
|
}, children: jsx(Dismiss16Regular, { "aria-hidden": "true" }) })] }, `${file.name}-${index}`));
|
|
3902
4170
|
}) }))] }), displayedHelper && (jsx("span", { id: helperId, role: isError ? 'alert' : undefined, className: clsx(styles$e.helperText, isError && styles$e.errorText), children: displayedHelper }))] }));
|
|
3903
|
-
}
|
|
4171
|
+
};
|
|
3904
4172
|
FileUpload.displayName = 'FileUpload';
|
|
3905
4173
|
|
|
3906
4174
|
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"};
|
|
3907
4175
|
|
|
3908
|
-
const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled = false, className, title = 'Filtrar', drawerWidth = "fit-content",
|
|
4176
|
+
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 }) => {
|
|
3909
4177
|
const [isOpen, setIsOpen] = useState(false);
|
|
3910
4178
|
const handleOpen = useCallback(() => {
|
|
3911
4179
|
setIsOpen(true);
|
|
@@ -3922,12 +4190,12 @@ const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled
|
|
|
3922
4190
|
const handleClear = useCallback(() => {
|
|
3923
4191
|
onClear?.();
|
|
3924
4192
|
}, [onClear]);
|
|
3925
|
-
return (jsxs("div", { className: clsx(styles$d.triggerWrapper, className), id: id, ...rest, children: [jsx(Button, { variant: variant, disabled: disabled, icon: icon ?? jsx(FilterRegular, {}), iconPosition: "left", onClick: handleOpen, children: jsxs("span", { className: styles$d.triggerContent, children: [buttonText,
|
|
4193
|
+
return (jsxs("div", { className: clsx(styles$d.triggerWrapper, className), id: id, ...rest, children: [jsx(Button, { variant: variant, disabled: disabled, icon: icon ?? jsx(FilterRegular, {}), iconPosition: "left", onClick: handleOpen, children: jsxs("span", { className: styles$d.triggerContent, children: [buttonText, appliedFilterCount > 0 && (jsx(Badge, { badgeValue: appliedFilterCount, filterVariant: true }))] }) }), jsx(Drawer, { isOpen: isOpen, onClose: handleClose, title: title, customWidth: drawerWidth, closeOnOverlayClick: true, closeOnEscape: true, headerContent: drawerHeaderContent, footer: jsxs("div", { className: styles$d.combinedFooter, children: [jsx(Button, { variant: "outlined", onClick: handleClear, children: "Limpar" }), jsx(Button, { onClick: handleApply, children: "Aplicar" })] }), children: jsx("div", { className: styles$d.body, children: children }) })] }));
|
|
3926
4194
|
};
|
|
3927
4195
|
|
|
3928
4196
|
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"};
|
|
3929
4197
|
|
|
3930
|
-
const Search =
|
|
4198
|
+
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 }) => {
|
|
3931
4199
|
const [internalValue, setInternalValue] = useState('');
|
|
3932
4200
|
const { internalRef: inputRef, setRefs: setInputRefs } = useInputKeyboardValue(ref);
|
|
3933
4201
|
const isControlled = value !== undefined && onChange !== undefined;
|
|
@@ -3999,7 +4267,7 @@ const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser
|
|
|
3999
4267
|
setInternalValue(val);
|
|
4000
4268
|
}
|
|
4001
4269
|
} }) }))] }));
|
|
4002
|
-
}
|
|
4270
|
+
};
|
|
4003
4271
|
Search.displayName = 'Search';
|
|
4004
4272
|
|
|
4005
4273
|
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 }) => {
|
|
@@ -4118,42 +4386,38 @@ const Filter = ({ mode = 'simple', ...props }) => {
|
|
|
4118
4386
|
return jsx(Simple, { ...props });
|
|
4119
4387
|
};
|
|
4120
4388
|
|
|
4121
|
-
var styles$b = {"
|
|
4122
|
-
|
|
4123
|
-
var styles$a = {"root":"Radio-module__root___7ElY2","wrapper":"Radio-module__wrapper___NYQ1y","disabled":"Radio-module__disabled___RZ0be","labelText":"Radio-module__labelText___Wkb41","item":"Radio-module__item___3Kvj7","itemWrapper":"Radio-module__itemWrapper___5KbM1","labelWrapper":"Radio-module__labelWrapper___LOHmJ","indicator":"Radio-module__indicator___TJ5hz"};
|
|
4124
|
-
|
|
4125
|
-
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', scale = 1, className, style, ...rest }) => {
|
|
4126
|
-
const generatedId = useId();
|
|
4127
|
-
const componentId = id || generatedId;
|
|
4128
|
-
return (jsx(RadioGroup.Root, { id: componentId, className: clsx(styles$a.root, className), style: { '--giro-scale': scale, ...style }, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
4129
|
-
const itemKey = id ?? value;
|
|
4130
|
-
const uniqueId = `${componentId}-item-${value}`;
|
|
4131
|
-
return (jsx("div", { className: clsx(styles$a.wrapper, { [styles$a.disabled]: disabled }), children: jsxs("label", { className: styles$a.labelWrapper, htmlFor: uniqueId, children: [jsx("div", { className: styles$a.itemWrapper, children: jsx(RadioGroup.Item, { disabled: disabled, className: styles$a.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsx(RadioGroup.Indicator, { className: styles$a.indicator }) }) }), jsx("span", { className: styles$a.labelText, children: label })] }) }, itemKey));
|
|
4132
|
-
}) }));
|
|
4133
|
-
};
|
|
4389
|
+
var styles$b = {"listItem":"ListItem-module__listItem___ljWE5","listItemRow":"ListItem-module__listItemRow___Ur5aJ","listItem-checkbox":"ListItem-module__listItem-checkbox___-cn1b","listItem-icon":"ListItem-module__listItem-icon___B-LXx","listItem-text":"ListItem-module__listItem-text___pLRU7","listItemDisabled":"ListItem-module__listItemDisabled___8gsyb","listItemWrapperText":"ListItem-module__listItemWrapperText___tT-Yj","listItemWrapperIcon":"ListItem-module__listItemWrapperIcon___qK4Ct","listItemTitle":"ListItem-module__listItemTitle___lpf-A","listItemSubtext":"ListItem-module__listItemSubtext___WDxHE","listItemChevron":"ListItem-module__listItemChevron___fCuqf","listItemChevronExpanded":"ListItem-module__listItemChevronExpanded___HYTON","listItemChildren":"ListItem-module__listItemChildren___H3Vur"};
|
|
4134
4390
|
|
|
4135
|
-
const ListItem = ({ id, className, variant = 'text', text,
|
|
4391
|
+
const ListItem = ({ id, className, variant = 'text', text, subText, disabled = false, checked = false, selected = false, onClick, onChange, icon, customWidth, scale = 1, children, defaultExpanded = false, expanded, onExpandedChange, ...rest }) => {
|
|
4136
4392
|
const componentId = useId();
|
|
4137
4393
|
const itemId = id || componentId;
|
|
4138
4394
|
const [internalChecked, setInternalChecked] = useState(checked);
|
|
4139
4395
|
const [internalSelected, setInternalSelected] = useState(selected);
|
|
4396
|
+
const [internalExpanded, setInternalExpanded] = useState(expanded ?? defaultExpanded);
|
|
4397
|
+
const [childrenCheckedMap, setChildrenCheckedMap] = useState({});
|
|
4398
|
+
const childrenCount = variant === 'checkbox'
|
|
4399
|
+
? React__default.Children.toArray(children).filter(child => React__default.isValidElement(child) && !child.props.disabled).length
|
|
4400
|
+
: 0;
|
|
4401
|
+
const checkedCount = Object.values(childrenCheckedMap).filter(Boolean).length;
|
|
4402
|
+
const isIndeterminate = childrenCount > 0 && checkedCount > 0 && checkedCount < childrenCount;
|
|
4403
|
+
const hasChildren = React__default.Children.count(children) > 0;
|
|
4140
4404
|
const handleCheckboxClick = useCallback((e) => {
|
|
4141
4405
|
if (disabled)
|
|
4142
4406
|
return;
|
|
4143
|
-
const newChecked = !internalChecked;
|
|
4407
|
+
const newChecked = isIndeterminate ? true : !internalChecked;
|
|
4144
4408
|
setInternalChecked(newChecked);
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
onChange?.(true);
|
|
4409
|
+
if (childrenCount > 0) {
|
|
4410
|
+
const newMap = {};
|
|
4411
|
+
React__default.Children.forEach(children, (child, index) => {
|
|
4412
|
+
if (React__default.isValidElement(child) && !child.props.disabled) {
|
|
4413
|
+
newMap[index] = newChecked;
|
|
4414
|
+
}
|
|
4415
|
+
});
|
|
4416
|
+
setChildrenCheckedMap(newMap);
|
|
4154
4417
|
}
|
|
4418
|
+
onChange?.(newChecked);
|
|
4155
4419
|
onClick?.(e);
|
|
4156
|
-
}, [disabled, internalChecked, onChange, onClick]);
|
|
4420
|
+
}, [disabled, internalChecked, isIndeterminate, childrenCount, onChange, onClick, children]);
|
|
4157
4421
|
const handleTextOrIconClick = useCallback((e) => {
|
|
4158
4422
|
if (disabled)
|
|
4159
4423
|
return;
|
|
@@ -4161,16 +4425,55 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
4161
4425
|
setInternalSelected(newSelected);
|
|
4162
4426
|
onClick?.(e);
|
|
4163
4427
|
}, [disabled, internalSelected, onClick]);
|
|
4428
|
+
const handleChildChange = useCallback((index, childChecked) => {
|
|
4429
|
+
setChildrenCheckedMap(prev => {
|
|
4430
|
+
const next = { ...prev, [index]: childChecked };
|
|
4431
|
+
const total = childrenCount;
|
|
4432
|
+
const checked = Object.values(next).filter(Boolean).length;
|
|
4433
|
+
if (checked === 0) {
|
|
4434
|
+
setInternalChecked(false);
|
|
4435
|
+
onChange?.(false);
|
|
4436
|
+
}
|
|
4437
|
+
else if (checked === total) {
|
|
4438
|
+
setInternalChecked(true);
|
|
4439
|
+
onChange?.(true);
|
|
4440
|
+
}
|
|
4441
|
+
return next;
|
|
4442
|
+
});
|
|
4443
|
+
}, [childrenCount, onChange]);
|
|
4444
|
+
const handleClick = useCallback((e) => {
|
|
4445
|
+
if (hasChildren) {
|
|
4446
|
+
if (disabled)
|
|
4447
|
+
return;
|
|
4448
|
+
const newExpanded = !internalExpanded;
|
|
4449
|
+
setInternalExpanded(newExpanded);
|
|
4450
|
+
onExpandedChange?.(newExpanded);
|
|
4451
|
+
return;
|
|
4452
|
+
}
|
|
4453
|
+
switch (variant) {
|
|
4454
|
+
case 'checkbox':
|
|
4455
|
+
handleCheckboxClick(e);
|
|
4456
|
+
break;
|
|
4457
|
+
case 'text':
|
|
4458
|
+
case 'icon':
|
|
4459
|
+
default:
|
|
4460
|
+
handleTextOrIconClick(e);
|
|
4461
|
+
break;
|
|
4462
|
+
}
|
|
4463
|
+
}, [hasChildren, disabled, internalExpanded, onExpandedChange, variant, handleCheckboxClick, handleTextOrIconClick]);
|
|
4164
4464
|
const handleKeyDown = useCallback((e) => {
|
|
4165
4465
|
if (!disabled && (e.key === 'Enter' || e.key === ' ')) {
|
|
4166
4466
|
e.preventDefault();
|
|
4467
|
+
if (hasChildren) {
|
|
4468
|
+
const newExpanded = !internalExpanded;
|
|
4469
|
+
setInternalExpanded(newExpanded);
|
|
4470
|
+
onExpandedChange?.(newExpanded);
|
|
4471
|
+
return;
|
|
4472
|
+
}
|
|
4167
4473
|
switch (variant) {
|
|
4168
4474
|
case 'checkbox':
|
|
4169
4475
|
handleCheckboxClick(e);
|
|
4170
4476
|
break;
|
|
4171
|
-
case 'radio':
|
|
4172
|
-
handleRadioClick(e);
|
|
4173
|
-
break;
|
|
4174
4477
|
case 'text':
|
|
4175
4478
|
case 'icon':
|
|
4176
4479
|
default:
|
|
@@ -4178,54 +4481,80 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
4178
4481
|
break;
|
|
4179
4482
|
}
|
|
4180
4483
|
}
|
|
4181
|
-
}, [disabled, variant, handleCheckboxClick,
|
|
4484
|
+
}, [disabled, hasChildren, internalExpanded, onExpandedChange, variant, handleCheckboxClick, handleTextOrIconClick]);
|
|
4182
4485
|
useEffect(() => {
|
|
4183
4486
|
setInternalChecked(checked);
|
|
4184
4487
|
}, [checked]);
|
|
4185
4488
|
useEffect(() => {
|
|
4186
4489
|
setInternalSelected(selected);
|
|
4187
4490
|
}, [selected]);
|
|
4491
|
+
useEffect(() => {
|
|
4492
|
+
if (expanded !== undefined)
|
|
4493
|
+
setInternalExpanded(expanded);
|
|
4494
|
+
}, [expanded]);
|
|
4495
|
+
useEffect(() => {
|
|
4496
|
+
if (!internalExpanded || variant !== 'checkbox' || childrenCount === 0)
|
|
4497
|
+
return;
|
|
4498
|
+
setChildrenCheckedMap(prev => {
|
|
4499
|
+
let changed = false;
|
|
4500
|
+
const next = { ...prev };
|
|
4501
|
+
React__default.Children.forEach(children, (child, index) => {
|
|
4502
|
+
if (React__default.isValidElement(child) && !child.props.disabled && !(index in next)) {
|
|
4503
|
+
next[index] = internalChecked;
|
|
4504
|
+
changed = true;
|
|
4505
|
+
}
|
|
4506
|
+
});
|
|
4507
|
+
return changed ? next : prev;
|
|
4508
|
+
});
|
|
4509
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4510
|
+
}, [internalExpanded, childrenCount, variant]);
|
|
4188
4511
|
const renderVariantContent = useCallback(() => {
|
|
4189
|
-
const validVariants = ['text', 'checkbox', '
|
|
4512
|
+
const validVariants = ['text', 'checkbox', 'icon'];
|
|
4190
4513
|
const currentVariant = validVariants.includes(variant) ? variant : 'text';
|
|
4191
4514
|
switch (currentVariant) {
|
|
4192
4515
|
case 'checkbox':
|
|
4193
|
-
return (jsxs(Fragment, { children: [jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxs("div", { className: styles$b
|
|
4194
|
-
case 'radio':
|
|
4195
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$b['zds-list-item__wrapper-radio'], children: jsx("span", { className: styles$b['zds-list-item__radio'], "aria-hidden": "true", children: jsx(Radio, { name: name, onValueChange: () => handleRadioClick({}), items: [{
|
|
4196
|
-
value: value || '',
|
|
4197
|
-
label: '',
|
|
4198
|
-
disabled: disabled
|
|
4199
|
-
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__title'], onClick: handleRadioClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], children: subText }))] })] }));
|
|
4516
|
+
return (jsxs(Fragment, { children: [jsx("span", { "aria-hidden": "true", onClick: hasChildren ? (e) => e.stopPropagation() : undefined, children: jsx(Checkbox, { checked: internalChecked, indeterminate: isIndeterminate, disabled: disabled, scale: scale, onCheckedChange: () => handleCheckboxClick({}) }) }), jsxs("div", { className: styles$b.listItemWrapperText, children: [jsx("span", { id: `${itemId}-text`, className: styles$b.listItemTitle, onClick: hasChildren ? (e) => { e.stopPropagation(); handleCheckboxClick(e); } : undefined, children: text }), subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b.listItemSubtext, children: subText }))] })] }));
|
|
4200
4517
|
case 'icon':
|
|
4201
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$b
|
|
4518
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: styles$b.listItemWrapperIcon, children: icon }), jsxs("div", { className: styles$b.listItemWrapperText, children: [jsx("span", { id: `${itemId}-text`, className: styles$b.listItemTitle, children: text }), subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b.listItemSubtext, children: subText }))] })] }));
|
|
4202
4519
|
case 'text':
|
|
4203
4520
|
default:
|
|
4204
|
-
return (jsxs("div", { className: styles$b
|
|
4521
|
+
return (jsxs("div", { className: styles$b.listItemWrapperText, children: [jsx("span", { id: `${itemId}-text`, className: styles$b.listItemTitle, children: text }), subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b.listItemSubtext, children: subText }))] }));
|
|
4205
4522
|
}
|
|
4206
|
-
}, [variant, itemId, internalChecked, disabled, handleCheckboxClick,
|
|
4207
|
-
const listItemClass = clsx(styles$b
|
|
4208
|
-
[styles$b[`
|
|
4209
|
-
[styles$b
|
|
4210
|
-
[styles$b['zds-list-item--hovered']]: hovered,
|
|
4523
|
+
}, [variant, itemId, internalChecked, isIndeterminate, disabled, handleCheckboxClick, text, subText, icon, scale, hasChildren]);
|
|
4524
|
+
const listItemClass = clsx(styles$b.listItem, {
|
|
4525
|
+
[styles$b[`listItem-${variant}`]]: variant,
|
|
4526
|
+
[styles$b.listItemDisabled]: disabled,
|
|
4211
4527
|
[className || '']: className
|
|
4212
4528
|
});
|
|
4213
|
-
const
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4529
|
+
const ariaChecked = variant === 'checkbox' ? internalChecked : undefined;
|
|
4530
|
+
const ariaRole = variant === 'checkbox' ? 'checkbox' : 'option';
|
|
4531
|
+
return (jsxs("li", { id: itemId, className: listItemClass, "data-testid": "list-item", style: {
|
|
4532
|
+
'--giro-scale': scale,
|
|
4533
|
+
...(customWidth != null ? { width: customWidth } : {}),
|
|
4534
|
+
}, ...rest, children: [jsxs("div", { role: ariaRole, className: styles$b.listItemRow, tabIndex: disabled ? -1 : 0, onClick: handleClick, onKeyDown: handleKeyDown, "aria-selected": variant === 'text' || variant === 'icon' ? internalSelected : undefined, "aria-disabled": disabled, "aria-checked": ariaChecked, "aria-expanded": hasChildren ? internalExpanded : undefined, "aria-labelledby": `${itemId}-text`, "aria-describedby": subText ? `${itemId}-subtext` : undefined, children: [renderVariantContent(), hasChildren && (jsx("span", { "data-testid": "list-item-chevron", "aria-hidden": "true", className: clsx(styles$b.listItemChevron, {
|
|
4535
|
+
[styles$b.listItemChevronExpanded]: internalExpanded,
|
|
4536
|
+
}), children: jsx(ChevronDown16Regular, {}) }))] }), hasChildren && internalExpanded && (jsx("ul", { className: styles$b.listItemChildren, role: "group", children: variant === 'checkbox'
|
|
4537
|
+
? React__default.Children.map(children, (child, index) => React__default.isValidElement(child)
|
|
4538
|
+
? React__default.cloneElement(child, {
|
|
4539
|
+
checked: child.props.disabled
|
|
4540
|
+
? child.props.checked
|
|
4541
|
+
: (childrenCheckedMap[index] ?? internalChecked),
|
|
4542
|
+
onChange: (childChecked) => {
|
|
4543
|
+
child.props.onChange?.(childChecked);
|
|
4544
|
+
handleChildChange(index, childChecked);
|
|
4545
|
+
},
|
|
4546
|
+
})
|
|
4547
|
+
: child)
|
|
4548
|
+
: children }))] }));
|
|
4220
4549
|
};
|
|
4221
4550
|
|
|
4222
|
-
var styles$
|
|
4551
|
+
var styles$a = {"content":"Menu-module__content___pnDF6","subContent":"Menu-module__subContent___O9T-y","itemsWrapper":"Menu-module__itemsWrapper___Fcg71","item":"Menu-module__item___S3HKY","subTrigger":"Menu-module__subTrigger___CdnJE","itemSubText":"Menu-module__itemSubText___U1HFP","itemIcon":"Menu-module__itemIcon___iyxmZ","wrapperText":"Menu-module__wrapperText___PomUe","itemText":"Menu-module__itemText___2fd2B","chevronIcon":"Menu-module__chevronIcon___Gda-U","searchWrapper":"Menu-module__searchWrapper___e0knQ","emptyState":"Menu-module__emptyState___3wh-S","loadingMore":"Menu-module__loadingMore___fUCvH"};
|
|
4223
4552
|
|
|
4224
4553
|
const MenuItem = memo(({ item, isSelected, onSelect }) => {
|
|
4225
4554
|
const handleSelect = () => {
|
|
4226
4555
|
onSelect(item);
|
|
4227
4556
|
};
|
|
4228
|
-
return (jsxs(DropdownMenu.Item, { className: clsx(styles$
|
|
4557
|
+
return (jsxs(DropdownMenu.Item, { className: clsx(styles$a.item), "data-selected": isSelected || undefined, onSelect: handleSelect, disabled: item.disabled, children: [item.icon && jsx("span", { className: styles$a.itemIcon, children: item.icon }), jsxs("div", { className: styles$a.wrapperText, children: [jsx("span", { className: styles$a.itemText, children: item.text }), item.subText && (jsx("span", { className: styles$a.itemSubText, children: item.subText }))] })] }));
|
|
4229
4558
|
});
|
|
4230
4559
|
MenuItem.displayName = 'MenuItem';
|
|
4231
4560
|
|
|
@@ -4453,7 +4782,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
4453
4782
|
const renderMenuItem = useCallback((item, key) => {
|
|
4454
4783
|
const hasChildren = item.children && item.children.length > 0;
|
|
4455
4784
|
if (hasChildren) {
|
|
4456
|
-
return (jsxs(DropdownMenu.Sub, { children: [jsxs(DropdownMenu.SubTrigger, { className: styles$
|
|
4785
|
+
return (jsxs(DropdownMenu.Sub, { children: [jsxs(DropdownMenu.SubTrigger, { className: styles$a.subTrigger, disabled: item.disabled, children: [item.icon && (jsx("span", { className: styles$a.itemIcon, children: item.icon })), jsxs("div", { className: styles$a.wrapperText, children: [jsx("span", { className: styles$a.itemText, children: item.text }), item.subText && (jsx("span", { className: styles$a.itemSubText, children: item.subText }))] }), jsx(ChevronRight16Filled, { className: styles$a.chevronIcon })] }), jsx(DropdownMenu.Portal, { children: jsx(DropdownMenu.SubContent, { className: styles$a.subContent, sideOffset: 16, collisionPadding: 20, children: item.children.map((childItem, childIndex) => renderMenuItem(childItem, `${key}-${childIndex}`)) }) })] }, key));
|
|
4457
4786
|
}
|
|
4458
4787
|
return (jsx(MenuItem, { item: item, isSelected: isItemSelected(item), onSelect: handleItemSelect }, key));
|
|
4459
4788
|
}, [handleItemSelect, isItemSelected]);
|
|
@@ -4464,7 +4793,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
4464
4793
|
hasReachedEndRef.current = false;
|
|
4465
4794
|
}
|
|
4466
4795
|
};
|
|
4467
|
-
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: triggerWithScale }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$
|
|
4796
|
+
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: triggerWithScale }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$a.content, className), style: { ...containerStyle, ...style }, sideOffset: 8, align: align, onPointerDown: () => { closedByPointerRef.current = true; }, onInteractOutside: () => { closedByPointerRef.current = true; }, onCloseAutoFocus: (e) => {
|
|
4468
4797
|
if (closedByPointerRef.current) {
|
|
4469
4798
|
e.preventDefault();
|
|
4470
4799
|
closedByPointerRef.current = false;
|
|
@@ -4473,10 +4802,10 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
4473
4802
|
if (search) {
|
|
4474
4803
|
e.stopPropagation();
|
|
4475
4804
|
}
|
|
4476
|
-
}, ...rest, children: [search && (jsx("div", { className: styles$
|
|
4805
|
+
}, ...rest, children: [search && (jsx("div", { className: styles$a.searchWrapper, children: jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxs("div", { className: styles$a.itemsWrapper, ref: itemsWrapperRef, style: { maxHeight: maxHeightStyle }, children: [filteredItems.length > 0 ? (filteredItems.map((item, index) => renderMenuItem(item, item.value || item.text || `item-${index}`))) : (jsx("div", { className: styles$a.emptyState, children: "Nenhum item encontrado" })), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$a.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
|
|
4477
4806
|
};
|
|
4478
4807
|
|
|
4479
|
-
var styles$
|
|
4808
|
+
var styles$9 = {"modalOverlay":"Modal-module__modalOverlay___rI8Wz","modalContent":"Modal-module__modalContent___6Cgb1","modalContent--fullscreen":"Modal-module__modalContent--fullscreen___QeBlG","modalHeader":"Modal-module__modalHeader___IuHIg","modalTitle":"Modal-module__modalTitle___9VDmr","modalBody":"Modal-module__modalBody___ohjQm","modalFooter":"Modal-module__modalFooter___TEqdK"};
|
|
4480
4809
|
|
|
4481
4810
|
const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, customHeight, fullscreen = false, ...rest }) => {
|
|
4482
4811
|
const contentRef = React.useRef(null);
|
|
@@ -4489,13 +4818,13 @@ const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeO
|
|
|
4489
4818
|
e.preventDefault();
|
|
4490
4819
|
contentRef.current?.focus();
|
|
4491
4820
|
};
|
|
4492
|
-
return (jsx(Dialog$1.Root, { open: isOpen, onOpenChange: handleOpenChange, ...rest, children: jsxs(Dialog$1.Portal, { children: [jsx(Dialog$1.Overlay, { className: styles$
|
|
4821
|
+
return (jsx(Dialog$1.Root, { open: isOpen, onOpenChange: handleOpenChange, ...rest, children: jsxs(Dialog$1.Portal, { children: [jsx(Dialog$1.Overlay, { className: styles$9.modalOverlay }), jsxs(Dialog$1.Content, { ref: contentRef, className: clsx(styles$9.modalContent, fullscreen && styles$9['modalContent--fullscreen'], className), id: id, style: {
|
|
4493
4822
|
'--modal-custom-width': customWidth,
|
|
4494
4823
|
'--modal-custom-height': customHeight,
|
|
4495
|
-
}, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [jsxs("header", { className: styles$
|
|
4824
|
+
}, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [jsxs("header", { className: styles$9.modalHeader, children: [title && (jsx(Dialog$1.Title, { className: styles$9.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsx("div", { children: headerContent })), jsx(Dialog$1.Close, { asChild: true, children: jsx(Button, { variant: "outlined", iconOnly: true, icon: jsx(Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) })] }), jsx("section", { className: styles$9.modalBody, children: children }), footer && (jsx("footer", { className: styles$9.modalFooter, children: footer }))] })] }) }));
|
|
4496
4825
|
};
|
|
4497
4826
|
|
|
4498
|
-
var styles$
|
|
4827
|
+
var styles$8 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
|
|
4499
4828
|
|
|
4500
4829
|
const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, decimalPlaces = 2, size = 'lg', id, valueIncrement = 1, scale = 1, className, style, inputSize, minValue = 0, maxValue = 9999, decrementAriaLabel = 'Decrease quantity', incrementAriaLabel = 'Increase quantity', inputAriaLabel = 'Quantity', ...rest }) => {
|
|
4501
4830
|
const initialValue = Math.min(Math.max(value, minValue), maxValue);
|
|
@@ -4676,11 +5005,23 @@ const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, deci
|
|
|
4676
5005
|
const inputSizeValue = inputSize !== undefined ? inputSize : Math.max(1, inputValue.length);
|
|
4677
5006
|
const uniqueId = useId();
|
|
4678
5007
|
const inputId = id || uniqueId;
|
|
4679
|
-
return (jsxs("div", { className: clsx(styles$
|
|
5008
|
+
return (jsxs("div", { className: clsx(styles$8.quantity, { [styles$8.disabled]: disabled }, className), style: { '--giro-scale': scale, ...style }, ...rest, children: [jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsx(Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": decrementAriaLabel, tooltipText: 'Diminuir', scale: scale }), jsx("input", { ref: inputRef, className: clsx(styles$8.quantityInput, { [styles$8.disabled]: disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, step: stepValue, "aria-label": inputAriaLabel, role: 'spinbutton', "aria-valuenow": internalValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric', size: inputSizeValue }), jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled || isMaxValue, "aria-label": incrementAriaLabel, icon: jsx(Add16Regular, {}), tooltipText: 'Aumentar', scale: scale })] }));
|
|
4680
5009
|
};
|
|
4681
5010
|
const memorizedQuantity = React__default.memo(Quantity);
|
|
4682
5011
|
memorizedQuantity.displayName = 'Quantity';
|
|
4683
5012
|
|
|
5013
|
+
var styles$7 = {"root":"Radio-module__root___7ElY2","wrapper":"Radio-module__wrapper___NYQ1y","disabled":"Radio-module__disabled___RZ0be","labelText":"Radio-module__labelText___Wkb41","item":"Radio-module__item___3Kvj7","itemWrapper":"Radio-module__itemWrapper___5KbM1","labelWrapper":"Radio-module__labelWrapper___LOHmJ","indicator":"Radio-module__indicator___TJ5hz"};
|
|
5014
|
+
|
|
5015
|
+
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', scale = 1, className, style, ...rest }) => {
|
|
5016
|
+
const generatedId = useId();
|
|
5017
|
+
const componentId = id || generatedId;
|
|
5018
|
+
return (jsx(RadioGroup.Root, { id: componentId, className: clsx(styles$7.root, className), style: { '--giro-scale': scale, ...style }, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
5019
|
+
const itemKey = id ?? value;
|
|
5020
|
+
const uniqueId = `${componentId}-item-${value}`;
|
|
5021
|
+
return (jsx("div", { className: clsx(styles$7.wrapper, { [styles$7.disabled]: disabled }), children: jsxs("label", { className: styles$7.labelWrapper, htmlFor: uniqueId, children: [jsx("div", { className: styles$7.itemWrapper, children: jsx(RadioGroup.Item, { disabled: disabled, className: styles$7.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsx(RadioGroup.Indicator, { className: styles$7.indicator }) }) }), jsx("span", { className: styles$7.labelText, children: label })] }) }, itemKey));
|
|
5022
|
+
}) }));
|
|
5023
|
+
};
|
|
5024
|
+
|
|
4684
5025
|
var styles$6 = {"fieldContainer":"Select-module__fieldContainer___zkWSZ","trigger":"Select-module__trigger___xZVUG","disabled":"Select-module__disabled___kkzG-","open":"Select-module__open___bTuTy","error":"Select-module__error___yikGO","hasValue":"Select-module__hasValue___56T9r","triggerText":"Select-module__triggerText___tfXlq","triggerIcon":"Select-module__triggerIcon___Smobj","content":"Select-module__content___Eftze","viewport":"Select-module__viewport___mMGOo","group":"Select-module__group___wErLt","container":"Select-module__container___U1UI1","containerLabel":"Select-module__containerLabel___-5qpN","searchWrapper":"Select-module__searchWrapper___H01Wp","item":"Select-module__item___72Rnu","subTitle":"Select-module__subTitle___FdYBH","checkboxItem":"Select-module__checkboxItem___Ehw-a","checkboxContent":"Select-module__checkboxContent___7eKLC","itemWrapper":"Select-module__itemWrapper___nPovg","title":"Select-module__title___bqW3p","icon":"Select-module__icon___RH27W","itemIndicator":"Select-module__itemIndicator___4DBU-","textContent":"Select-module__textContent___k1SLX","helper":"Select-module__helper___pTp7X","errorMessage":"Select-module__errorMessage___--vrn","noResults":"Select-module__noResults___IxsAN","loadingMore":"Select-module__loadingMore___DjAUE","expandableItemContainer":"Select-module__expandableItemContainer___w4ZIb","chevron":"Select-module__chevron___Kgee3","childrenWrapper":"Select-module__childrenWrapper___2NnS-"};
|
|
4685
5026
|
|
|
4686
5027
|
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange, value, ...restProps }) => {
|
|
@@ -4756,13 +5097,13 @@ const ExpandableSelectItem = ({ item, variant, onSelect, selectedValues, level =
|
|
|
4756
5097
|
}, 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 && (jsx("span", { className: styles$6.icon, children: item.icon })), jsxs("div", { className: styles$6.textContent, children: [jsx("div", { className: styles$6.title, children: item.text }), item.subTitle && jsx("div", { className: styles$6.subTitle, children: item.subTitle })] }), hasChildren && (jsx("span", { className: styles$6.chevron, children: isExpanded ? jsx(ChevronDown16Regular, {}) : jsx(ChevronRight16Regular, {}) }))] }) }), hasChildren && isExpanded && (jsx("div", { className: styles$6.childrenWrapper, children: item.children.map((child) => (jsx(ExpandableSelectItem, { item: child, variant: variant, onSelect: onSelect, selectedValues: selectedValues, level: level + 1 }, child.id || child.value))) }))] }));
|
|
4757
5098
|
};
|
|
4758
5099
|
|
|
4759
|
-
const SelectItem =
|
|
5100
|
+
const SelectItem = ({ ref, text, subTitle, icon, disabled, value, variant, disableFocusOnHover, ...restProps }) => {
|
|
4760
5101
|
return (jsxs("div", { className: clsx(styles$6.itemWrapper, {
|
|
4761
5102
|
[styles$6.disabled]: disabled,
|
|
4762
5103
|
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsx("span", { className: styles$6.icon, children: icon })), jsxs(Select$1.Item, { className: clsx(styles$6.item, {
|
|
4763
5104
|
[styles$6.disabled]: disabled,
|
|
4764
5105
|
}), value: value, disabled: disabled, onPointerMove: disableFocusOnHover ? (e) => e.preventDefault() : undefined, ...restProps, children: [jsx(Select$1.ItemText, { className: styles$6.title, children: text }), subTitle && jsx("div", { className: styles$6.subTitle, children: subTitle }), jsx(Select$1.ItemIndicator, { className: styles$6.itemIndicator })] })] }));
|
|
4765
|
-
}
|
|
5106
|
+
};
|
|
4766
5107
|
SelectItem.displayName = 'SelectItem';
|
|
4767
5108
|
|
|
4768
5109
|
const initialState = {
|
|
@@ -4797,7 +5138,7 @@ function selectReducer(state, action) {
|
|
|
4797
5138
|
return state;
|
|
4798
5139
|
}
|
|
4799
5140
|
}
|
|
4800
|
-
function useSelectLogic({ value, required = false, search = false, onValueChange, onOpenChange, enableApiSearch = false, onApiSearch, isSearching = false, }) {
|
|
5141
|
+
function useSelectLogic({ value, required = false, search = false, onValueChange, onOpenChange, enableApiSearch = false, onApiSearch, isSearching = false, error, }) {
|
|
4801
5142
|
const [state, dispatch] = useReducer(selectReducer, {
|
|
4802
5143
|
...initialState,
|
|
4803
5144
|
selectedValues: Array.isArray(value) ? value : value ? [value] : [],
|
|
@@ -4824,6 +5165,14 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4824
5165
|
const newValues = Array.isArray(value) ? value : value ? [value] : [];
|
|
4825
5166
|
dispatch({ type: 'SET_SELECTED_VALUES', payload: newValues });
|
|
4826
5167
|
}, [value]);
|
|
5168
|
+
useEffect(() => {
|
|
5169
|
+
if (error !== undefined) {
|
|
5170
|
+
dispatch({ type: 'SET_ERROR', payload: error });
|
|
5171
|
+
if (error) {
|
|
5172
|
+
dispatch({ type: 'SET_TOUCHED', payload: true });
|
|
5173
|
+
}
|
|
5174
|
+
}
|
|
5175
|
+
}, [error]);
|
|
4827
5176
|
useEffect(() => {
|
|
4828
5177
|
if (state.isOpen && search) {
|
|
4829
5178
|
setTimeout(() => {
|
|
@@ -4990,7 +5339,7 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4990
5339
|
};
|
|
4991
5340
|
}
|
|
4992
5341
|
|
|
4993
|
-
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,
|
|
5342
|
+
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 }) => {
|
|
4994
5343
|
const componentId = useId();
|
|
4995
5344
|
const selectId = `select-${componentId}`;
|
|
4996
5345
|
const viewportRef = useRef(null);
|
|
@@ -5004,6 +5353,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
5004
5353
|
enableApiSearch,
|
|
5005
5354
|
onApiSearch,
|
|
5006
5355
|
isSearching,
|
|
5356
|
+
error,
|
|
5007
5357
|
});
|
|
5008
5358
|
useEffect(() => {
|
|
5009
5359
|
const viewport = viewportRef.current;
|
|
@@ -5071,7 +5421,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
5071
5421
|
onApiSearch('');
|
|
5072
5422
|
}
|
|
5073
5423
|
};
|
|
5074
|
-
return (jsx(Select$1.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: jsxs("div", { className: clsx(styles$6.container, className), style: { ...containerStyle, ...style }, "data-testid": testId, children: [jsx("div", { className: styles$6.fieldContainer, children: jsxs("div", { className: styles$6.containerLabel, children: [jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip:
|
|
5424
|
+
return (jsx(Select$1.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: jsxs("div", { className: clsx(styles$6.container, className), style: { ...containerStyle, ...style }, "data-testid": testId, children: [jsx("div", { className: styles$6.fieldContainer, children: jsxs("div", { className: styles$6.containerLabel, children: [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 }), jsxs(Select$1.Trigger, { className: clsx(styles$6.trigger, {
|
|
5075
5425
|
[styles$6.error]: state.hasError && state.touched,
|
|
5076
5426
|
[styles$6.disabled]: disabled,
|
|
5077
5427
|
[styles$6.hasValue]: state.selectedValues.length > 0,
|
|
@@ -5096,276 +5446,55 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
5096
5446
|
};
|
|
5097
5447
|
Select.displayName = 'Select';
|
|
5098
5448
|
|
|
5099
|
-
var styles$5 = {"tableContainer":"Table-
|
|
5449
|
+
var styles$5 = {"wrapper":"Table-module__wrapper___KMc04","tableContainer":"Table-module__tableContainer___byysv","tableHeader":"Table-module__tableHeader___urbxZ","bulkActionsBar":"Table-module__bulkActionsBar___Irfnt","bulkActionsInfo":"Table-module__bulkActionsInfo___pLTb6","bulkActionsClearButton":"Table-module__bulkActionsClearButton___jjQTq","bulkActionsLabel":"Table-module__bulkActionsLabel___QB3N9","bulkActionsButtons":"Table-module__bulkActionsButtons___1anDO","tablePagination":"Table-module__tablePagination___MbqJy","table":"Table-module__table___9xCJC","tableHead":"Table-module__tableHead___oVEa6","tableTh":"Table-module__tableTh___U02-Y","tableThContent":"Table-module__tableThContent___61AqT","tableSortButton":"Table-module__tableSortButton___ZgLkx","tableBody":"Table-module__tableBody___fq4Aa","tableTd":"Table-module__tableTd___OfW9v","tableRow":"Table-module__tableRow___COJNu","checkboxCell":"Table-module__checkboxCell___B9vHM","tableSortIconNeutral":"Table-module__tableSortIconNeutral___uvnHs","tableSortIcon":"Table-module__tableSortIcon___YVa2Q","tableHeaderLeft":"Table-module__tableHeaderLeft___gtnru","tableHeaderSearchContainer":"Table-module__tableHeaderSearchContainer___Yy8-s","tableHeaderSearch":"Table-module__tableHeaderSearch___swewU","tableHeaderFilters":"Table-module__tableHeaderFilters___ncatO","tableHeaderFilterLabel":"Table-module__tableHeaderFilterLabel___r3DI-","tableHeaderFilterItems":"Table-module__tableHeaderFilterItems___kQDsY","tablePaginationSelect":"Table-module__tablePaginationSelect___l2aYm","tablePaginationLabel":"Table-module__tablePaginationLabel___S9VOr","tablePaginationSelectInput":"Table-module__tablePaginationSelectInput___wdhOQ","tablePaginationInfo":"Table-module__tablePaginationInfo___r1v8R","tablePaginationControls":"Table-module__tablePaginationControls___IL8rm","tablePaginationButton":"Table-module__tablePaginationButton___SNDQq","tableScrollWrapper":"Table-module__tableScrollWrapper___SvEOw","tableEmptyCell":"Table-module__tableEmptyCell___N5a9t","tableEmpty":"Table-module__tableEmpty___0yPZ0","tableEmptyContent":"Table-module__tableEmptyContent___uNWpN","tableEmptyText":"Table-module__tableEmptyText___7kY7Q","tableEmptyTitle":"Table-module__tableEmptyTitle___Y-7z8","tableEmptyCaption":"Table-module__tableEmptyCaption___4PZ14","tableCellMaxHeight":"Table-module__tableCellMaxHeight___-tcyU"};
|
|
5100
5450
|
|
|
5101
|
-
|
|
5102
|
-
* Componente de ícone SVG para estado vazio da tabela
|
|
5103
|
-
* Exibe um ícone de lupa com design personalizado do Zanthus Design System
|
|
5104
|
-
* @returns Elemento SVG para estado vazio
|
|
5105
|
-
*/
|
|
5106
|
-
const EmptyRows150Color = () => (jsxs("svg", { width: '150', height: '150', viewBox: '0 0 150 150', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: [jsx("circle", { cx: '75', cy: '75', r: '75', fill: '#E8E8EE' }), jsx("path", { d: 'M67.6111 63.3889C69.36 63.3889 70.7778 64.8067 70.7778 66.5556V81.3333C70.7778 83.0822 69.36 84.5 67.6111 84.5C65.8622 84.5 64.4444 83.0822 64.4444 81.3333V66.5556C64.4444 64.8067 65.8622 63.3889 67.6111 63.3889ZM67.6111 59.1667C69.943 59.1667 71.8333 57.2763 71.8333 54.9444C71.8333 52.6126 69.943 50.7222 67.6111 50.7222C65.2792 50.7222 63.3889 52.6126 63.3889 54.9444C63.3889 57.2763 65.2792 59.1667 67.6111 59.1667ZM67.6111 37C84.5172 37 98.2222 50.7051 98.2222 67.6111C98.2222 74.9235 95.6583 81.637 91.3803 86.9017L112.073 107.594C113.309 108.831 113.309 110.836 112.073 112.073C110.948 113.197 109.189 113.299 107.949 112.379L107.594 112.073L86.9017 91.3803C81.637 95.6583 74.9235 98.2222 67.6111 98.2222C50.7051 98.2222 37 84.5172 37 67.6111C37 50.7051 50.7051 37 67.6111 37ZM67.6111 43.3333C54.2029 43.3333 43.3333 54.2029 43.3333 67.6111C43.3333 81.0194 54.2029 91.8889 67.6111 91.8889C81.0194 91.8889 91.8889 81.0194 91.8889 67.6111C91.8889 54.2029 81.0194 43.3333 67.6111 43.3333Z', fill: '#3B45F2' })] }));
|
|
5107
|
-
|
|
5108
|
-
/*! *****************************************************************************
|
|
5109
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5110
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5111
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
5112
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
5113
|
-
|
|
5114
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
5115
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
5116
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
5117
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
5118
|
-
|
|
5119
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
5120
|
-
and limitations under the License.
|
|
5121
|
-
***************************************************************************** */
|
|
5122
|
-
|
|
5123
|
-
var __assign = function() {
|
|
5124
|
-
__assign = Object.assign || function __assign(t) {
|
|
5125
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5126
|
-
s = arguments[i];
|
|
5127
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
5128
|
-
}
|
|
5129
|
-
return t;
|
|
5130
|
-
};
|
|
5131
|
-
return __assign.apply(this, arguments);
|
|
5132
|
-
};
|
|
5133
|
-
|
|
5134
|
-
function __rest(s, e) {
|
|
5135
|
-
var t = {};
|
|
5136
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5137
|
-
t[p] = s[p];
|
|
5138
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
5139
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5140
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
5141
|
-
t[p[i]] = s[p[i]];
|
|
5142
|
-
}
|
|
5143
|
-
return t;
|
|
5144
|
-
}
|
|
5145
|
-
|
|
5146
|
-
var uid = (function () {
|
|
5147
|
-
return Math.random()
|
|
5148
|
-
.toString(36)
|
|
5149
|
-
.substring(6);
|
|
5150
|
-
});
|
|
5151
|
-
|
|
5152
|
-
var SVG = function (_a) {
|
|
5153
|
-
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"]);
|
|
5154
|
-
var fixedId = uniqueKey || uid();
|
|
5155
|
-
var idClip = "".concat(fixedId, "-diff");
|
|
5156
|
-
var idGradient = "".concat(fixedId, "-animated-diff");
|
|
5157
|
-
var idAria = "".concat(fixedId, "-aria");
|
|
5158
|
-
var rtlStyle = rtl ? { transform: 'scaleX(-1)' } : null;
|
|
5159
|
-
var dur = "".concat(speed, "s");
|
|
5160
|
-
var from = "".concat(gradientRatio * -1, " 0");
|
|
5161
|
-
var to = "".concat(gradientRatio, " 0");
|
|
5162
|
-
return (createElement("svg", __assign({ "aria-labelledby": idAria, role: "img", style: __assign(__assign({}, style), rtlStyle) }, props),
|
|
5163
|
-
title ? createElement("title", { id: idAria }, title) : null,
|
|
5164
|
-
beforeMask && isValidElement(beforeMask) ? beforeMask : null,
|
|
5165
|
-
createElement("rect", { role: "presentation", x: "0", y: "0", width: "100%", height: "100%", clipPath: "url(".concat(baseUrl, "#").concat(idClip, ")"), style: { fill: "url(".concat(baseUrl, "#").concat(idGradient, ")") } }),
|
|
5166
|
-
createElement("defs", null,
|
|
5167
|
-
createElement("clipPath", { id: idClip }, children),
|
|
5168
|
-
createElement("linearGradient", { id: idGradient, gradientTransform: "translate(".concat(from, ")") },
|
|
5169
|
-
createElement("stop", { offset: "0%", stopColor: backgroundColor, stopOpacity: backgroundOpacity }),
|
|
5170
|
-
createElement("stop", { offset: "50%", stopColor: foregroundColor, stopOpacity: foregroundOpacity }),
|
|
5171
|
-
createElement("stop", { offset: "100%", stopColor: backgroundColor, stopOpacity: backgroundOpacity }),
|
|
5172
|
-
animate && (createElement("animateTransform", { attributeName: "gradientTransform", type: "translate", values: "".concat(from, "; 0 0; ").concat(to), dur: dur, repeatCount: "indefinite" }))))));
|
|
5173
|
-
};
|
|
5451
|
+
const EmptyState = ({ emptyIcon, emptyTitle, emptyText }) => (jsxs("div", { className: styles$5.tableEmpty, children: [jsx("div", { className: styles$5.tableEmptyContent, children: emptyIcon ?? jsx(SearchInfo20Regular, {}) }), jsxs("div", { className: styles$5.tableEmptyText, children: [jsx("h3", { className: styles$5.tableEmptyTitle, children: emptyTitle ?? 'Nenhum dado encontrado' }), jsx("p", { className: styles$5.tableEmptyCaption, children: emptyText ?? 'Nenhum registro encontrado' })] })] }));
|
|
5174
5452
|
|
|
5175
|
-
var
|
|
5176
|
-
return props.children ? createElement(SVG, __assign({}, props)) : createElement(ReactContentLoaderFacebook, __assign({}, props));
|
|
5177
|
-
};
|
|
5178
|
-
|
|
5179
|
-
var ReactContentLoaderFacebook = function (props) { return (createElement(ContentLoader, __assign({ viewBox: "0 0 476 124" }, props),
|
|
5180
|
-
createElement("rect", { x: "48", y: "8", width: "88", height: "6", rx: "3" }),
|
|
5181
|
-
createElement("rect", { x: "48", y: "26", width: "52", height: "6", rx: "3" }),
|
|
5182
|
-
createElement("rect", { x: "0", y: "56", width: "410", height: "6", rx: "3" }),
|
|
5183
|
-
createElement("rect", { x: "0", y: "72", width: "380", height: "6", rx: "3" }),
|
|
5184
|
-
createElement("rect", { x: "0", y: "88", width: "178", height: "6", rx: "3" }),
|
|
5185
|
-
createElement("circle", { cx: "20", cy: "20", r: "20" }))); };
|
|
5186
|
-
|
|
5187
|
-
/**
|
|
5188
|
-
* Componente de loading para lista de tabela
|
|
5189
|
-
* Simula o carregamento de dados em formato de tabela usando ContentLoader
|
|
5190
|
-
* @param props - Propriedades adicionais para o ContentLoader
|
|
5191
|
-
* @returns Elemento de loading animado
|
|
5192
|
-
*/
|
|
5193
|
-
const LoaderList = (props) => (jsxs(ContentLoader, { speed: 1, width: "100%", viewBox: "0 0 1272 652", backgroundColor: "#F5F5F7", foregroundColor: "#FFFFFF", ...props, children: [jsx("rect", { x: "0", y: "0", rx: "8", ry: "8", width: "1272", height: "44" }), jsx("rect", { x: "0", y: "76", rx: "12", ry: "12", width: "402", height: "24" }), jsx("rect", { x: "0", y: "116", rx: "8", ry: "8", width: "280", height: "16" }), jsx("rect", { x: "426", y: "76", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "426", y: "116", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "694", y: "76", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "694", y: "116", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "962", y: "76", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "962", y: "116", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "1129", y: "76", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "1129", y: "116", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "0", y: "164", rx: "12", ry: "12", width: "402", height: "24" }), jsx("rect", { x: "0", y: "204", rx: "8", ry: "8", width: "280", height: "16" }), jsx("rect", { x: "426", y: "164", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "426", y: "204", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "694", y: "164", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "694", y: "204", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "962", y: "164", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "962", y: "204", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "1129", y: "164", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "1129", y: "204", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "0", y: "252", rx: "12", ry: "12", width: "402", height: "24" }), jsx("rect", { x: "0", y: "292", rx: "8", ry: "8", width: "280", height: "16" }), jsx("rect", { x: "426", y: "252", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "426", y: "292", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "694", y: "252", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "694", y: "292", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "962", y: "252", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "962", y: "292", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "1129", y: "252", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "1129", y: "292", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "0", y: "340", rx: "12", ry: "12", width: "402", height: "24" }), jsx("rect", { x: "0", y: "380", rx: "8", ry: "8", width: "280", height: "16" }), jsx("rect", { x: "426", y: "340", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "426", y: "380", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "694", y: "340", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "694", y: "380", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "962", y: "340", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "962", y: "380", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "1129", y: "340", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "1129", y: "380", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "0", y: "428", rx: "12", ry: "12", width: "402", height: "24" }), jsx("rect", { x: "0", y: "468", rx: "8", ry: "8", width: "280", height: "16" }), jsx("rect", { x: "426", y: "428", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "426", y: "468", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "694", y: "428", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "694", y: "468", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "962", y: "428", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "962", y: "468", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "1129", y: "428", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "1129", y: "468", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "0", y: "516", rx: "12", ry: "12", width: "402", height: "24" }), jsx("rect", { x: "0", y: "556", rx: "8", ry: "8", width: "280", height: "16" }), jsx("rect", { x: "426", y: "516", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "426", y: "556", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "694", y: "516", rx: "12", ry: "12", width: "244", height: "24" }), jsx("rect", { x: "694", y: "556", rx: "8", ry: "8", width: "178", height: "16" }), jsx("rect", { x: "962", y: "516", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "962", y: "556", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "1129", y: "516", rx: "12", ry: "12", width: "143", height: "24" }), jsx("rect", { x: "1129", y: "556", rx: "8", ry: "8", width: "90", height: "16" }), jsx("rect", { x: "0", y: "604", rx: "8", ry: "8", width: "1272", height: "48" })] }));
|
|
5453
|
+
var styles$4 = {"toggle":"ToggleButton-module__toggle___c1Ym-","item":"ToggleButton-module__item___2Qll-","toggle-lg":"ToggleButton-module__toggle-lg___8f3lo","item-lg":"ToggleButton-module__item-lg___479w-","toggle-sm":"ToggleButton-module__toggle-sm___SAGGb","item-sm":"ToggleButton-module__item-sm___4ju--","toggleIconLeft":"ToggleButton-module__toggleIconLeft___VwgKk","toggleWithIcon":"ToggleButton-module__toggleWithIcon___WbCr7","toggleIconOnly":"ToggleButton-module__toggleIconOnly___4iMEp","group":"ToggleButton-module__group___BoR-e"};
|
|
5194
5454
|
|
|
5195
|
-
const
|
|
5196
|
-
const
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
rowSelection.onChange?.(newKeys, newRows);
|
|
5203
|
-
}
|
|
5204
|
-
else {
|
|
5205
|
-
setInternalKeys(newKeys);
|
|
5206
|
-
rowSelection?.onChange?.(newKeys, newRows);
|
|
5207
|
-
}
|
|
5208
|
-
}, [dataSource, rowSelection]);
|
|
5209
|
-
const toggleRow = useCallback((key) => {
|
|
5210
|
-
const newKeys = selectedSet.has(key)
|
|
5211
|
-
? selectedKeys.filter(k => k !== key)
|
|
5212
|
-
: [...selectedKeys, key];
|
|
5213
|
-
handleChange(newKeys);
|
|
5214
|
-
}, [selectedKeys, selectedSet, handleChange]);
|
|
5215
|
-
const selectableKeys = useMemo(() => (dataSource
|
|
5216
|
-
.map((row, index) => ({ index, disabled: rowSelection?.getCheckboxProps?.(row, index)?.disabled }))
|
|
5217
|
-
.filter(({ disabled }) => !disabled)
|
|
5218
|
-
.map(({ index }) => index)), [dataSource, rowSelection]);
|
|
5219
|
-
const toggleAll = useCallback(() => {
|
|
5220
|
-
const isAllSelectableSelected = selectableKeys.every(k => selectedSet.has(k));
|
|
5221
|
-
const newKeys = isAllSelectableSelected
|
|
5222
|
-
? selectedKeys.filter(k => !selectableKeys.includes(k))
|
|
5223
|
-
: [...new Set([...selectedKeys, ...selectableKeys])];
|
|
5224
|
-
handleChange(newKeys);
|
|
5225
|
-
}, [selectableKeys, selectedKeys, selectedSet, handleChange]);
|
|
5226
|
-
const isAllSelected = selectableKeys.length > 0 && selectableKeys.every(k => selectedSet.has(k));
|
|
5227
|
-
const isIndeterminate = selectableKeys.some(k => selectedSet.has(k)) && !isAllSelected;
|
|
5228
|
-
return {
|
|
5229
|
-
selectedSet,
|
|
5230
|
-
selectedKeys,
|
|
5231
|
-
toggleRow,
|
|
5232
|
-
toggleAll,
|
|
5233
|
-
isAllSelected,
|
|
5234
|
-
isIndeterminate,
|
|
5235
|
-
};
|
|
5236
|
-
};
|
|
5237
|
-
const renderCell = (column, row, index) => {
|
|
5238
|
-
if (column.render) {
|
|
5239
|
-
return column.render(row, index);
|
|
5240
|
-
}
|
|
5241
|
-
const value = row[column.key];
|
|
5242
|
-
switch (column.type) {
|
|
5243
|
-
case 'datetime':
|
|
5244
|
-
if (!value)
|
|
5245
|
-
return '';
|
|
5246
|
-
try {
|
|
5247
|
-
const date = new Date(value);
|
|
5248
|
-
return format(date, column.format || 'dd/MM/yyyy', { locale: ptBR$1 });
|
|
5249
|
-
}
|
|
5250
|
-
catch {
|
|
5251
|
-
return value;
|
|
5252
|
-
}
|
|
5253
|
-
default:
|
|
5254
|
-
return value;
|
|
5455
|
+
const Toggle = ({ pressed, defaultPressed, onPressedChange, disabled = false, className, children, id, size = 'lg', scale = 1, style, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', icon, iconOnly = false, mode: _mode, selectionType: _type, value: _value, defaultValue: _defaultValue, onValueChange: _onValueChange, orientation: _orientation, items: _items, ...rest }) => {
|
|
5456
|
+
const toggle = (jsx(Toggle$1.Root, { pressed: pressed, defaultPressed: defaultPressed, onPressedChange: onPressedChange, disabled: disabled, className: clsx(styles$4.toggle, styles$4[`toggle-${size}`], {
|
|
5457
|
+
[styles$4.toggleIconOnly]: iconOnly,
|
|
5458
|
+
[styles$4.toggleWithIcon]: !!icon && !iconOnly,
|
|
5459
|
+
}, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: iconOnly ? (jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: icon })) : (jsxs(Fragment, { children: [icon && jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: icon }), children] })) }));
|
|
5460
|
+
if (tooltipText) {
|
|
5461
|
+
return (jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: toggle }));
|
|
5255
5462
|
}
|
|
5463
|
+
return toggle;
|
|
5256
5464
|
};
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
return (jsx(Checkbox, { checked: selectedSet.has(index), onCheckedChange: () => toggleRow(index), disabled: props.disabled }));
|
|
5272
|
-
},
|
|
5273
|
-
align: 'center',
|
|
5465
|
+
|
|
5466
|
+
const ToggleGroup = ({ selectionType = 'single', value, defaultValue, onValueChange, orientation = 'horizontal', disabled = false, items = [], children, className, id, size = 'lg', scale = 1, style, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', mode: _mode, icon: _icon, iconOnly: _iconOnly, pressed: _pressed, defaultPressed: _defaultPressed, onPressedChange: _onPressedChange, ...rest }) => {
|
|
5467
|
+
const rootProps = selectionType === 'multiple'
|
|
5468
|
+
? {
|
|
5469
|
+
type: 'multiple',
|
|
5470
|
+
value: value,
|
|
5471
|
+
defaultValue: defaultValue,
|
|
5472
|
+
onValueChange: onValueChange,
|
|
5473
|
+
}
|
|
5474
|
+
: {
|
|
5475
|
+
type: 'single',
|
|
5476
|
+
value: value,
|
|
5477
|
+
defaultValue: defaultValue,
|
|
5478
|
+
onValueChange: onValueChange,
|
|
5274
5479
|
};
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5480
|
+
const group = (jsx(ToggleGroup$1.Root, { ...rootProps, orientation: orientation, disabled: disabled, className: clsx(styles$4.group, className), id: id, style: { '--giro-scale': scale, ...style }, ...rest, children: children ??
|
|
5481
|
+
items.map((item) => (jsx(ToggleGroup$1.Item, { value: item.value, disabled: item.disabled, className: clsx(styles$4.item, styles$4[`item-${size}`], {
|
|
5482
|
+
[styles$4.toggleIconOnly]: item.iconOnly,
|
|
5483
|
+
[styles$4.toggleWithIcon]: !!item.icon && !item.iconOnly,
|
|
5484
|
+
}), style: { '--giro-scale': scale }, children: item.iconOnly ? (jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon })) : (jsxs(Fragment, { children: [item.icon && jsx("span", { className: styles$4.toggleIconLeft, "aria-hidden": "true", children: item.icon }), item.label] })) }, item.value))) }));
|
|
5485
|
+
if (tooltipText) {
|
|
5486
|
+
return (jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: group }));
|
|
5280
5487
|
}
|
|
5281
|
-
|
|
5282
|
-
return (jsx("div", { className: clsx(styles$5.tableContainer, className), ...rest, children: jsx("div", { className: styles$5.tableScrollWrapper, children: jsxs("table", { className: styles$5.table, role: "table", "aria-label": "Tabela de dados", "aria-describedby": loading ? `${tableId}-loading` : undefined, "aria-rowcount": dataSource.length + 1, children: [jsx("thead", { className: styles$5.tableHead, children: jsx("tr", { children: finalColumns.map((column) => (jsx("th", { className: clsx(styles$5.tableTh, column.align && `text-${column.align}`), style: column.style, children: jsx("div", { className: styles$5.tableThContent, children: column.label }) }, column.key))) }) }), jsx("tbody", { className: styles$5.tableBody, children: dataSource.length > 0 ? (dataSource.map((row, index) => {
|
|
5283
|
-
const rowProps = onRow?.(row, index) || {};
|
|
5284
|
-
return (jsx("tr", { className: clsx(styles$5.tableRow, rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: finalColumns.map((column) => (jsx("td", { className: clsx(styles$5.tableTd, column.align && `text-${column.align}`), children: renderCell(column, row, index) }, column.key))) }, index));
|
|
5285
|
-
})) : (jsx("tr", { children: jsx("td", { colSpan: finalColumns.length, className: styles$5.tableEmptyCell, children: emptyText }) })) })] }) }) }));
|
|
5286
|
-
};
|
|
5287
|
-
|
|
5288
|
-
const isCalendarFilter = (filter) => {
|
|
5289
|
-
return filter.type === 'calendar';
|
|
5290
|
-
};
|
|
5291
|
-
const isCheckboxFilter = (filter) => {
|
|
5292
|
-
return filter.type === 'multiple' || filter.type === 'single';
|
|
5293
|
-
};
|
|
5294
|
-
const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceholder = 'Pesquisar...', showSearch = true, showFilters = false, filters, filterItems = [], className = '', ...rest }) => {
|
|
5295
|
-
const [internalSearchValue, setInternalSearchValue] = useState(searchValue);
|
|
5296
|
-
React__default.useEffect(() => {
|
|
5297
|
-
setInternalSearchValue(searchValue);
|
|
5298
|
-
}, [searchValue]);
|
|
5299
|
-
const handleInputChange = (e) => {
|
|
5300
|
-
const value = e.target.value;
|
|
5301
|
-
setInternalSearchValue(value);
|
|
5302
|
-
if (value === '' && onSearchChange) {
|
|
5303
|
-
onSearchChange('');
|
|
5304
|
-
}
|
|
5305
|
-
};
|
|
5306
|
-
const handleKeyDown = (e) => {
|
|
5307
|
-
if (e.key === 'Enter') {
|
|
5308
|
-
e.preventDefault();
|
|
5309
|
-
if (onSearch) {
|
|
5310
|
-
onSearch(internalSearchValue);
|
|
5311
|
-
}
|
|
5312
|
-
else if (onSearchChange) {
|
|
5313
|
-
onSearchChange(internalSearchValue);
|
|
5314
|
-
}
|
|
5315
|
-
}
|
|
5316
|
-
};
|
|
5317
|
-
const hasFilters = filters || (filterItems && filterItems.length > 0);
|
|
5318
|
-
return (jsxs("div", { className: `${styles$5.tableHeader} ${className}`.trim(), ...rest, children: [showSearch && (onSearchChange || onSearch) && (jsx("div", { className: styles$5.tableHeaderSearchContainer, children: jsx(Search, { value: internalSearchValue, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: searchPlaceholder, className: styles$5.tableHeaderSearch }) })), showFilters && (jsx("div", { className: styles$5.tableHeaderFilters, children: hasFilters ? (jsxs("div", { className: styles$5.tableHeaderFiltersContent, children: [filters && (jsx("div", { className: styles$5.tableHeaderCustomFilters, children: filters })), jsxs("div", { className: styles$5.tableHeaderFiltersWrapper, children: [jsx("span", { className: styles$5.tableHeaderFilterLabel, children: "Filtros" }), jsx("div", { className: styles$5.tableHeaderFilterItems, children: filterItems && filterItems.map((filterItem, index) => {
|
|
5319
|
-
const commonProps = {
|
|
5320
|
-
buttonText: filterItem.buttonText,
|
|
5321
|
-
icon: filterItem.icon,
|
|
5322
|
-
side: filterItem.side,
|
|
5323
|
-
align: filterItem.align,
|
|
5324
|
-
disabled: filterItem.disabled,
|
|
5325
|
-
variant: 'outlined',
|
|
5326
|
-
onOpen: () => filterItem.onToggle?.(true),
|
|
5327
|
-
onClose: () => filterItem.onToggle?.(false),
|
|
5328
|
-
};
|
|
5329
|
-
if (isCalendarFilter(filterItem)) {
|
|
5330
|
-
return (jsx(Filter, { ...commonProps, type: "calendar", selectedDate: filterItem.selectedDate, onDateSelect: filterItem.onDateSelect, onClearDate: filterItem.onClear, minDate: filterItem.minDate, maxDate: filterItem.maxDate, placeholder: filterItem.placeholder }, filterItem.id || index));
|
|
5331
|
-
}
|
|
5332
|
-
if (isCheckboxFilter(filterItem)) {
|
|
5333
|
-
return (jsx(Filter, { ...commonProps, type: filterItem.type, items: filterItem.items, selectedIds: filterItem.selectedIds, onApplyFilter: filterItem.onSelectionChange, placeholder: filterItem.placeholder, enableSearch: filterItem.enableSearch }, filterItem.id || index));
|
|
5334
|
-
}
|
|
5335
|
-
console.warn('TableHeader: Tipo de filtro não reconhecido:', filterItem);
|
|
5336
|
-
return null;
|
|
5337
|
-
}) })] })] })) : (jsx("div", { className: styles$5.tableHeaderFiltersPlaceholder, children: jsx("span", { children: "Nenhum filtro dispon\u00EDvel" }) })) }))] }));
|
|
5488
|
+
return group;
|
|
5338
5489
|
};
|
|
5339
5490
|
|
|
5340
|
-
const
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
const canGoNext = currentPage < totalPages && !disabled;
|
|
5346
|
-
const handlePrevious = () => {
|
|
5347
|
-
if (canGoPrev) {
|
|
5348
|
-
onPageChange(currentPage - 1);
|
|
5349
|
-
}
|
|
5350
|
-
};
|
|
5351
|
-
const handleNext = () => {
|
|
5352
|
-
if (canGoNext) {
|
|
5353
|
-
onPageChange(currentPage + 1);
|
|
5354
|
-
}
|
|
5355
|
-
};
|
|
5356
|
-
const handleItemsPerPageChange = (event) => {
|
|
5357
|
-
const newItemsPerPage = Number(event.target.value);
|
|
5358
|
-
onItemsPerPageChange(newItemsPerPage);
|
|
5359
|
-
};
|
|
5360
|
-
return (jsxs("div", { className: `${styles$5.tablePagination} ${className}`.trim(), ...rest, children: [jsxs("div", { className: styles$5.tablePaginationSelect, children: [jsx("label", { htmlFor: "items-per-page", className: styles$5.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsx("select", { id: "items-per-page", value: itemsPerPage, onChange: handleItemsPerPageChange, disabled: disabled, className: styles$5.tablePaginationSelectInput, children: pageSizeOptions.map((option) => (jsx("option", { value: option, children: option }, option))) })] }), jsx("div", { className: styles$5.tablePaginationInfo, children: jsx("span", { children: totalItems > 0
|
|
5361
|
-
? `${startItem}–${endItem} de ${totalItems}`
|
|
5362
|
-
: '0 itens' }) }), jsxs("div", { className: styles$5.tablePaginationControls, children: [jsx("button", { className: styles$5.tablePaginationButton, onClick: handlePrevious, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsx(ChevronLeft16Regular, {}) }), jsx("button", { className: styles$5.tablePaginationButton, onClick: handleNext, disabled: !canGoNext, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsx(ChevronRight16Regular, {}) })] })] }));
|
|
5491
|
+
const ToggleButton = ({ mode = 'simple', ...props }) => {
|
|
5492
|
+
if (mode === 'combined') {
|
|
5493
|
+
return jsx(ToggleGroup, { ...props });
|
|
5494
|
+
}
|
|
5495
|
+
return jsx(Toggle, { ...props });
|
|
5363
5496
|
};
|
|
5364
5497
|
|
|
5365
|
-
var styles$4 = {"wrapper":"Table-module__wrapper___KMc04","tableContainer":"Table-module__tableContainer___byysv","tableHeader":"Table-module__tableHeader___urbxZ","bulkActionsBar":"Table-module__bulkActionsBar___Irfnt","bulkActionsInfo":"Table-module__bulkActionsInfo___pLTb6","bulkActionsClearButton":"Table-module__bulkActionsClearButton___jjQTq","bulkActionsLabel":"Table-module__bulkActionsLabel___QB3N9","bulkActionsButtons":"Table-module__bulkActionsButtons___1anDO","tablePagination":"Table-module__tablePagination___MbqJy","table":"Table-module__table___9xCJC","tableHead":"Table-module__tableHead___oVEa6","tableTh":"Table-module__tableTh___U02-Y","tableThContent":"Table-module__tableThContent___61AqT","tableSortButton":"Table-module__tableSortButton___ZgLkx","tableBody":"Table-module__tableBody___fq4Aa","tableTd":"Table-module__tableTd___OfW9v","tableRow":"Table-module__tableRow___COJNu","checkboxCell":"Table-module__checkboxCell___B9vHM","tableSortIconNeutral":"Table-module__tableSortIconNeutral___uvnHs","tableSortIcon":"Table-module__tableSortIcon___YVa2Q","tableHeaderSearchContainer":"Table-module__tableHeaderSearchContainer___Yy8-s","tableHeaderSearch":"Table-module__tableHeaderSearch___swewU","tableHeaderFilters":"Table-module__tableHeaderFilters___ncatO","tableHeaderFilterLabel":"Table-module__tableHeaderFilterLabel___r3DI-","tableHeaderFilterItems":"Table-module__tableHeaderFilterItems___kQDsY","tablePaginationSelect":"Table-module__tablePaginationSelect___l2aYm","tablePaginationLabel":"Table-module__tablePaginationLabel___S9VOr","tablePaginationSelectInput":"Table-module__tablePaginationSelectInput___wdhOQ","tablePaginationInfo":"Table-module__tablePaginationInfo___r1v8R","tablePaginationControls":"Table-module__tablePaginationControls___IL8rm","tablePaginationButton":"Table-module__tablePaginationButton___SNDQq","tableScrollWrapper":"Table-module__tableScrollWrapper___SvEOw","tableEmptyCell":"Table-module__tableEmptyCell___N5a9t","tableEmpty":"Table-module__tableEmpty___0yPZ0","tableEmptyContent":"Table-module__tableEmptyContent___uNWpN","tableEmptyText":"Table-module__tableEmptyText___7kY7Q","tableEmptyTitle":"Table-module__tableEmptyTitle___Y-7z8","tableEmptyCaption":"Table-module__tableEmptyCaption___4PZ14","tableCellMaxHeight":"Table-module__tableCellMaxHeight___-tcyU"};
|
|
5366
|
-
|
|
5367
|
-
const EmptyState = ({ emptyIcon, emptyTitle, emptyText }) => (jsxs("div", { className: styles$4.tableEmpty, children: [jsx("div", { className: styles$4.tableEmptyContent, children: emptyIcon ?? jsx(SearchInfo20Regular, {}) }), jsxs("div", { className: styles$4.tableEmptyText, children: [jsx("h3", { className: styles$4.tableEmptyTitle, children: emptyTitle ?? 'Nenhum dado encontrado' }), jsx("p", { className: styles$4.tableEmptyCaption, children: emptyText ?? 'Nenhum registro encontrado' })] })] }));
|
|
5368
|
-
|
|
5369
5498
|
const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSorting = true, bulkActions, header, footer, loading = false, emptyIcon, emptyTitle, emptyText, onRow, className, }) => {
|
|
5370
5499
|
const isRowSelectionEnabled = !!rowSelectionConfig;
|
|
5371
5500
|
const isControlled = rowSelectionConfig?.selectedRowKeys !== undefined;
|
|
@@ -5375,6 +5504,19 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5375
5504
|
setPendingSearch(header.searchValue);
|
|
5376
5505
|
}
|
|
5377
5506
|
}, [header?.searchValue]);
|
|
5507
|
+
const [activeView, setActiveView] = useState(header?.viewToggle?.value ??
|
|
5508
|
+
header?.viewToggle?.defaultValue ??
|
|
5509
|
+
header?.viewToggle?.items?.[0]?.value ??
|
|
5510
|
+
'');
|
|
5511
|
+
useEffect(() => {
|
|
5512
|
+
if (header?.viewToggle?.value !== undefined) {
|
|
5513
|
+
setActiveView(header.viewToggle.value);
|
|
5514
|
+
}
|
|
5515
|
+
}, [header?.viewToggle?.value]);
|
|
5516
|
+
const currentViewData = header?.viewToggle?.views?.[activeView];
|
|
5517
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5518
|
+
const effectiveColumns = (currentViewData?.columns ?? columns);
|
|
5519
|
+
const effectiveData = currentViewData?.data ?? data;
|
|
5378
5520
|
const [rowSelectionState, setRowSelectionState] = useState({});
|
|
5379
5521
|
const rowSelectionRef = useRef({});
|
|
5380
5522
|
const externalSelectionState = useMemo(() => {
|
|
@@ -5396,13 +5538,13 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5396
5538
|
size: 48,
|
|
5397
5539
|
enableSorting: false,
|
|
5398
5540
|
enableColumnFilter: false,
|
|
5399
|
-
header: ({ table: t }) => (jsx("div", { className: styles$
|
|
5400
|
-
cell: ({ row }) => (jsx("div", { className: styles$
|
|
5541
|
+
header: ({ table: t }) => (jsx("div", { className: styles$5.checkboxCell, children: jsx(Checkbox, { checked: t.getIsAllPageRowsSelected(), indeterminate: t.getIsSomePageRowsSelected(), disabled: rowSelectionConfig?.disableSelectAll, onCheckedChange: (checked) => t.toggleAllPageRowsSelected(checked) }) })),
|
|
5542
|
+
cell: ({ row }) => (jsx("div", { className: styles$5.checkboxCell, children: jsx(Checkbox, { checked: row.getIsSelected(), disabled: !row.getCanSelect(), onCheckedChange: (checked) => row.toggleSelected(checked) }) })),
|
|
5401
5543
|
}), [rowSelectionConfig?.disableSelectAll]);
|
|
5402
|
-
const resolvedColumns = useMemo(() => (isRowSelectionEnabled ? [selectionColumn, ...
|
|
5544
|
+
const resolvedColumns = useMemo(() => (isRowSelectionEnabled ? [selectionColumn, ...effectiveColumns] : effectiveColumns), [isRowSelectionEnabled, selectionColumn, effectiveColumns]);
|
|
5403
5545
|
const showSearch = !!(header?.onSearchChange);
|
|
5404
5546
|
const table = useReactTable({
|
|
5405
|
-
data,
|
|
5547
|
+
data: effectiveData,
|
|
5406
5548
|
columns: resolvedColumns,
|
|
5407
5549
|
defaultColumn: { minSize: 44, size: 0 },
|
|
5408
5550
|
state: {
|
|
@@ -5445,7 +5587,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5445
5587
|
const totalPages = footer ? Math.ceil(effectiveTotalItems / pageSize) : 0;
|
|
5446
5588
|
const canGoPrev = pageIndex > 0;
|
|
5447
5589
|
const canGoNext = pageIndex + 1 < totalPages;
|
|
5448
|
-
const skeletonRowCount = footer ? pageSize : (
|
|
5590
|
+
const skeletonRowCount = footer ? pageSize : (effectiveData.length > 0 ? effectiveData.length : pageSize);
|
|
5449
5591
|
const selectedRows = useMemo(() => table
|
|
5450
5592
|
.getCoreRowModel()
|
|
5451
5593
|
.rows.filter((r) => effectiveRowSelection[r.id])
|
|
@@ -5475,24 +5617,38 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5475
5617
|
setPagination({ pageIndex: 0, pageSize: size });
|
|
5476
5618
|
footer?.onPageSizeChange?.(size);
|
|
5477
5619
|
};
|
|
5478
|
-
return (jsxs("div", { className: clsx(styles$
|
|
5620
|
+
return (jsxs("div", { className: clsx(styles$5.wrapper, className), children: [showBulkActions && (jsxs("div", { className: styles$5.bulkActionsBar, children: [jsxs("div", { className: styles$5.bulkActionsInfo, children: [jsx(Button, { variant: "text", iconOnly: true, icon: jsx(Dismiss16Regular, {}), ariaLabel: "Limpar sele\u00E7\u00E3o", onClick: handleClearSelection, className: styles$5.bulkActionsClearButton }), jsx("span", { className: styles$5.bulkActionsLabel, children: bulkActions.label
|
|
5479
5621
|
? bulkActions.label(selectedCount, selectedRows)
|
|
5480
|
-
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsx("div", { className: styles$
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5622
|
+
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsx("div", { className: styles$5.bulkActionsButtons, children: bulkActions.actions.map((action, index) => (jsx(Button, { variant: action.variant ?? 'outlined', type: "button", disabled: action.disabled, onClick: action.onClick, size: "sm", children: action.label }, index))) })] })), header && (jsxs("div", { className: styles$5.tableHeader, children: [jsxs("div", { className: styles$5.tableHeaderLeft, children: [showSearch && (jsx("div", { className: styles$5.tableHeaderSearchContainer, children: jsx(Search, { value: pendingSearch, virtualKeyboard: header.virtualKeyboard, searchMode: header?.searchMode ?? "on-enter", onChange: (e) => {
|
|
5623
|
+
setPendingSearch(e.target.value);
|
|
5624
|
+
}, onSearch: (val) => {
|
|
5625
|
+
if (footer) {
|
|
5626
|
+
setPagination((prev) => ({ ...prev, pageIndex: 0 }));
|
|
5627
|
+
footer?.onPageChange?.(1);
|
|
5628
|
+
}
|
|
5629
|
+
header?.onSearchChange?.(val);
|
|
5630
|
+
}, onClear: () => {
|
|
5631
|
+
setPendingSearch('');
|
|
5632
|
+
if (footer) {
|
|
5633
|
+
setPagination((prev) => ({ ...prev, pageIndex: 0 }));
|
|
5634
|
+
footer?.onPageChange?.(1);
|
|
5635
|
+
}
|
|
5636
|
+
header?.onSearchChange?.('');
|
|
5637
|
+
}, placeholder: header.searchPlaceholder ?? 'Pesquisar...', className: styles$5.tableHeaderSearch }) })), header.viewToggle && (jsx(ToggleButton, { mode: "combined", selectionType: "single", value: activeView, onValueChange: (val) => {
|
|
5638
|
+
if (!val)
|
|
5639
|
+
return;
|
|
5640
|
+
setActiveView(val);
|
|
5641
|
+
if (footer) {
|
|
5642
|
+
setPagination((prev) => ({ ...prev, pageIndex: 0 }));
|
|
5643
|
+
footer?.onPageChange?.(1);
|
|
5644
|
+
}
|
|
5645
|
+
header.viewToggle?.onValueChange?.(val);
|
|
5646
|
+
}, items: header.viewToggle.items.map((item) => ({
|
|
5647
|
+
value: item.value,
|
|
5648
|
+
icon: item.icon,
|
|
5649
|
+
iconOnly: true,
|
|
5650
|
+
tooltipText: item.tooltipText,
|
|
5651
|
+
})) }))] }), !!header.filterItems?.length && (jsxs("div", { className: styles$5.tableHeaderFilters, children: [header.filterItems.some((item) => item.type !== 'combined') && (jsx("span", { className: styles$5.tableHeaderFilterLabel, children: "Filtros" })), jsx("div", { className: styles$5.tableHeaderFilterItems, children: header.filterItems.map((filterItem, index) => {
|
|
5496
5652
|
const commonProps = {
|
|
5497
5653
|
buttonText: filterItem.buttonText,
|
|
5498
5654
|
icon: filterItem.icon,
|
|
@@ -5504,36 +5660,36 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5504
5660
|
onClose: () => filterItem.onToggle?.(false),
|
|
5505
5661
|
};
|
|
5506
5662
|
if (filterItem.type === 'combined') {
|
|
5507
|
-
return (jsx(Filter, { mode: "combined", buttonText: filterItem.buttonText, icon: filterItem.icon, title: filterItem.title, drawerWidth: filterItem.drawerWidth,
|
|
5663
|
+
return (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));
|
|
5508
5664
|
}
|
|
5509
5665
|
if (filterItem.type === 'calendar') {
|
|
5510
5666
|
return (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));
|
|
5511
5667
|
}
|
|
5512
5668
|
return (jsx(Filter, { ...commonProps, type: filterItem.type, items: filterItem.items, selectedIds: filterItem.selectedIds, onApplyFilter: filterItem.onSelectionChange, placeholder: filterItem.placeholder, enableSearch: filterItem.enableSearch }, filterItem.id ?? index));
|
|
5513
|
-
}) })] }))] })), jsx("div", { className: styles$
|
|
5669
|
+
}) })] }))] })), jsx("div", { className: styles$5.tableContainer, children: jsx("div", { className: styles$5.tableScrollWrapper, children: jsxs("table", { className: styles$5.table, "aria-label": "Tabela de dados", "aria-rowcount": data.length + 1, children: [jsx("thead", { className: styles$5.tableHead, children: table.getHeaderGroups().map((headerGroup) => (jsx("tr", { children: headerGroup.headers.map((col) => (jsx("th", { className: styles$5.tableTh, style: {
|
|
5514
5670
|
textAlign: col.column.columnDef.meta?.align,
|
|
5515
5671
|
width: col.column.columnDef.size || undefined,
|
|
5516
5672
|
minWidth: col.column.columnDef.minSize,
|
|
5517
5673
|
maxWidth: col.column.columnDef.maxSize !== Number.MAX_SAFE_INTEGER
|
|
5518
5674
|
? col.column.columnDef.maxSize
|
|
5519
5675
|
: undefined,
|
|
5520
|
-
}, children: jsx("div", { className: styles$
|
|
5676
|
+
}, children: jsx("div", { className: styles$5.tableThContent, children: col.isPlaceholder ? null : col.column.getCanSort() ? (jsxs("button", { type: "button", className: styles$5.tableSortButton, onClick: col.column.getToggleSortingHandler(), "aria-label": `Ordenar por ${typeof col.column.columnDef.header === 'string' ? col.column.columnDef.header : col.id}`, children: [flexRender(col.column.columnDef.header, col.getContext()), col.column.getIsSorted() === 'asc' ? (jsx(ArrowSortUp16Regular, { className: styles$5.tableSortIcon })) : col.column.getIsSorted() === 'desc' ? (jsx(ArrowSortDown16Regular, { className: styles$5.tableSortIcon })) : (jsx(ArrowSort16Regular, { className: clsx(styles$5.tableSortIcon, styles$5.tableSortIconNeutral) }))] })) : (flexRender(col.column.columnDef.header, col.getContext())) }) }, col.id))) }, headerGroup.id))) }), jsx("tbody", { className: styles$5.tableBody, children: loading ? (Array.from({ length: skeletonRowCount }).map((_, rowIdx) => (jsx("tr", { className: styles$5.tableRow, children: table.getVisibleLeafColumns().map((col) => (jsx("td", { className: styles$5.tableTd, children: jsx(Skeleton, {}) }, col.id))) }, `skeleton-row-${rowIdx}`)))) : table.getRowModel().rows.length > 0 ? (table.getRowModel().rows.map((row, index) => {
|
|
5521
5677
|
const rowProps = onRow?.(row.original, index) ?? {};
|
|
5522
|
-
return (jsx("tr", { className: clsx(styles$
|
|
5678
|
+
return (jsx("tr", { className: clsx(styles$5.tableRow, rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: row.getVisibleCells().map((cell) => (jsx("td", { className: styles$5.tableTd, style: {
|
|
5523
5679
|
textAlign: cell.column.columnDef.meta?.align,
|
|
5524
5680
|
width: cell.column.columnDef.size || undefined,
|
|
5525
5681
|
minWidth: cell.column.columnDef.minSize,
|
|
5526
5682
|
maxWidth: cell.column.columnDef.maxSize !== Number.MAX_SAFE_INTEGER
|
|
5527
5683
|
? cell.column.columnDef.maxSize
|
|
5528
5684
|
: undefined,
|
|
5529
|
-
}, children:
|
|
5530
|
-
})) : (jsx("tr", { children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, className: styles$
|
|
5685
|
+
}, children: jsx("div", { className: styles$5.tableCellMaxHeight, style: { maxHeight: cell.column.columnDef.meta?.maxHeight ?? '64px' }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }) }, cell.id))) }, row.id));
|
|
5686
|
+
})) : (jsx("tr", { children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, className: styles$5.tableEmptyCell, children: jsx(EmptyState, { emptyIcon: emptyIcon, emptyTitle: emptyTitle, emptyText: emptyText }) }) })) })] }) }) }), footer && (jsxs("div", { className: styles$5.tablePagination, children: [jsxs("div", { className: styles$5.tablePaginationSelect, children: [jsx("label", { htmlFor: "tablev2-page-size", className: styles$5.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsx("select", { id: "tablev2-page-size", value: pageSize, onChange: handlePageSizeChange, className: styles$5.tablePaginationSelectInput, children: (footer.pageSizeOptions ?? [10, 25, 50, 100]).map((opt) => (jsx("option", { value: opt, children: opt }, opt))) })] }), jsx("div", { className: styles$5.tablePaginationInfo, children: jsx("span", { children: totalPages > 0
|
|
5531
5687
|
? `${pageIndex + 1} de ${totalPages}`
|
|
5532
|
-
: '0 páginas' }) }), jsxs("div", { className: styles$
|
|
5688
|
+
: '0 páginas' }) }), jsxs("div", { className: styles$5.tablePaginationControls, children: [jsx("button", { className: styles$5.tablePaginationButton, onClick: () => {
|
|
5533
5689
|
const newPage = pageIndex - 1;
|
|
5534
5690
|
setPagination((prev) => ({ ...prev, pageIndex: newPage }));
|
|
5535
5691
|
footer?.onPageChange?.(newPage + 1);
|
|
5536
|
-
}, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsx(ChevronLeft16Regular, {}) }), jsx("button", { className: styles$
|
|
5692
|
+
}, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsx(ChevronLeft16Regular, {}) }), jsx("button", { className: styles$5.tablePaginationButton, onClick: () => {
|
|
5537
5693
|
const newPage = pageIndex + 1;
|
|
5538
5694
|
setPagination((prev) => ({ ...prev, pageIndex: newPage }));
|
|
5539
5695
|
footer?.onPageChange?.(newPage + 1);
|
|
@@ -5542,7 +5698,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5542
5698
|
|
|
5543
5699
|
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"};
|
|
5544
5700
|
|
|
5545
|
-
const TextArea =
|
|
5701
|
+
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 }) => {
|
|
5546
5702
|
const normalizeValue = (val) => {
|
|
5547
5703
|
return val === undefined || val === null ? '' : String(val);
|
|
5548
5704
|
};
|
|
@@ -5574,24 +5730,24 @@ const TextArea = forwardRef(({ className, value, label, placeholder, onChange, d
|
|
|
5574
5730
|
onFocus?.(e);
|
|
5575
5731
|
}, [onFocus]);
|
|
5576
5732
|
const hasError = Boolean(textareaError) || Boolean(error);
|
|
5577
|
-
const displayHelperText = (error ? errorMessage : undefined) || textareaError || helperText
|
|
5733
|
+
const displayHelperText = (error ? errorMessage : undefined) || textareaError || helperText;
|
|
5578
5734
|
const helperId = (textareaError || error)
|
|
5579
5735
|
? `${componentId}-error`
|
|
5580
5736
|
: helperText
|
|
5581
5737
|
? `${componentId}-helper`
|
|
5582
5738
|
: undefined;
|
|
5583
5739
|
const containerClass = clsx(styles$3.container, disabled && styles$3.disabled, hasError && !disabled && styles$3.error, className);
|
|
5584
|
-
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip:
|
|
5740
|
+
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: !!tooltipText, tooltipText: tooltipText, side: tooltipSide, align: tooltipAlign, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$3.inputWrapper, children: [jsx("div", { className: styles$3.inputContainer, children: 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)) && (jsxs("div", { className: styles$3.footer, children: [((error && errorMessage) || textareaError || helperText) && (jsx("span", { id: helperId, className: styles$3.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText })), charCount && maxLength && (jsxs("span", { className: styles$3.charCount, children: [textareaValue.length, "/", maxLength] }))] }))] }), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsx("div", { className: "virtualKeyboardWrapper", children: jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, maxLength: maxLength, value: textareaValue, targetRef: textareaRef, onChange: (val) => {
|
|
5585
5741
|
if (!disabled && (!maxLength || val.length <= maxLength)) {
|
|
5586
5742
|
setTextareaValue(val);
|
|
5587
5743
|
onChange?.(val);
|
|
5588
5744
|
}
|
|
5589
5745
|
} }) }))] }));
|
|
5590
|
-
}
|
|
5746
|
+
};
|
|
5591
5747
|
TextArea.displayName = 'TextArea';
|
|
5592
5748
|
var TextArea_default = React__default.memo(TextArea);
|
|
5593
5749
|
|
|
5594
|
-
var styles$2 = {"toastViewport":"Toast-module__toastViewport___Ns71-","toastRoot":"Toast-module__toastRoot___ZtA3x","slideIn":"Toast-module__slideIn___QcXWP","toastTitle":"Toast-module__toastTitle___WbjNH","toastContent":"Toast-module__toastContent___IY5QB","toastClose":"Toast-module__toastClose___FqVsT","Icon":"Toast-module__Icon___ERU9c","iconInfo":"Toast-module__iconInfo___G-II3","iconSuccess":"Toast-module__iconSuccess___N8iF1","iconAlert":"Toast-module__iconAlert___SSf8u"};
|
|
5750
|
+
var styles$2 = {"toastViewport":"Toast-module__toastViewport___Ns71-","toastRoot":"Toast-module__toastRoot___ZtA3x","slideIn":"Toast-module__slideIn___QcXWP","fadeOut":"Toast-module__fadeOut___0WaGy","toastTitle":"Toast-module__toastTitle___WbjNH","toastContent":"Toast-module__toastContent___IY5QB","toastClose":"Toast-module__toastClose___FqVsT","Icon":"Toast-module__Icon___ERU9c","iconInfo":"Toast-module__iconInfo___G-II3","iconSuccess":"Toast-module__iconSuccess___N8iF1","iconAlert":"Toast-module__iconAlert___SSf8u"};
|
|
5595
5751
|
|
|
5596
5752
|
/**
|
|
5597
5753
|
* Contexto React que armazena o estado e as ações do sistema de Toast.
|
|
@@ -6105,5 +6261,5 @@ function useInfiniteScroll({ status, page, lastPage, onLoadMore, threshold = 0.1
|
|
|
6105
6261
|
};
|
|
6106
6262
|
}
|
|
6107
6263
|
|
|
6108
|
-
export { Avatar, Badge, Button, Calendar, Callout, Card, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, FileUpload, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch,
|
|
6264
|
+
export { Avatar, Badge, Button, Calendar, Callout, Card, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, FileUpload, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, TableV2, TextArea_default as TextArea, TextField$1 as TextField, Toast, ToastContainer, ToastProvider, ToggleButton, Tooltip, VerificationCode, VirtualKeyboard, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
6109
6265
|
//# sourceMappingURL=index.esm.js.map
|