@wistia/ui 0.4.14-beta.e86c32fa.64ed100 → 0.4.14
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 +108 -467
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -23
- package/dist/index.d.ts +1 -23
- package/dist/index.mjs +28 -386
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.d.mts
CHANGED
|
@@ -19,28 +19,6 @@ declare const UIProvider: ({ children }: UIProviderProps) => react_jsx_runtime.J
|
|
|
19
19
|
*/
|
|
20
20
|
declare const copyToClipboard: (textToCopy: string) => Promise<void>;
|
|
21
21
|
|
|
22
|
-
declare const dateTime: {
|
|
23
|
-
buildTimeDuration: (numberOfMilliseconds: number) => Duration;
|
|
24
|
-
dateOnlyISOString: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
25
|
-
dateOnlyString: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
26
|
-
dateOnlyStringForSentence: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
27
|
-
dateOnlyStringNumeric: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
28
|
-
dateTimeRounded: DateTimeRoundedOverload;
|
|
29
|
-
dateTimeString: (date: Date | number | string | null | undefined, { timeZone }?: DateOnlyStringOptions) => string;
|
|
30
|
-
dateTimeStringForSentence: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
31
|
-
dateTimeToDate: (dateTime: Partial<WistiaDateTimeObject> | null | undefined) => Date | null;
|
|
32
|
-
dateTimeToISO: (dateTime: Partial<WistiaDateTimeObject>) => string | null;
|
|
33
|
-
dateToDateTime: (date: Date | null | undefined) => WistiaDateTimeObject | null;
|
|
34
|
-
dateUTCOffset: (date: Date) => string;
|
|
35
|
-
dayOfWeekString: (date: Date | null, { timeZone }?: DateOnlyStringOptions) => string;
|
|
36
|
-
mediaDurationString: (numberOfMilliseconds: number) => string;
|
|
37
|
-
millisecondsToDurationISOString: (numberOfMilliseconds: number) => string;
|
|
38
|
-
monthDayStringNumeric: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
39
|
-
sessionDurationString: (numberOfMilliseconds: number) => string;
|
|
40
|
-
timeAgoString: (date: Date, { nowAnchor }?: TimeAgoOptions) => string;
|
|
41
|
-
timeOnlyString: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
22
|
declare const mq: {
|
|
45
23
|
xsAndUp: () => string;
|
|
46
24
|
smAndUp: () => string;
|
|
@@ -2229,4 +2207,4 @@ type DataCardTrendProps = {
|
|
|
2229
2207
|
};
|
|
2230
2208
|
declare const DataCardTrend: ({ direction, outlook, children, ...props }: DataCardTrendProps) => JSX.Element;
|
|
2231
2209
|
|
|
2232
|
-
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard,
|
|
2210
|
+
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,28 +19,6 @@ declare const UIProvider: ({ children }: UIProviderProps) => react_jsx_runtime.J
|
|
|
19
19
|
*/
|
|
20
20
|
declare const copyToClipboard: (textToCopy: string) => Promise<void>;
|
|
21
21
|
|
|
22
|
-
declare const dateTime: {
|
|
23
|
-
buildTimeDuration: (numberOfMilliseconds: number) => Duration;
|
|
24
|
-
dateOnlyISOString: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
25
|
-
dateOnlyString: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
26
|
-
dateOnlyStringForSentence: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
27
|
-
dateOnlyStringNumeric: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
28
|
-
dateTimeRounded: DateTimeRoundedOverload;
|
|
29
|
-
dateTimeString: (date: Date | number | string | null | undefined, { timeZone }?: DateOnlyStringOptions) => string;
|
|
30
|
-
dateTimeStringForSentence: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
31
|
-
dateTimeToDate: (dateTime: Partial<WistiaDateTimeObject> | null | undefined) => Date | null;
|
|
32
|
-
dateTimeToISO: (dateTime: Partial<WistiaDateTimeObject>) => string | null;
|
|
33
|
-
dateToDateTime: (date: Date | null | undefined) => WistiaDateTimeObject | null;
|
|
34
|
-
dateUTCOffset: (date: Date) => string;
|
|
35
|
-
dayOfWeekString: (date: Date | null, { timeZone }?: DateOnlyStringOptions) => string;
|
|
36
|
-
mediaDurationString: (numberOfMilliseconds: number) => string;
|
|
37
|
-
millisecondsToDurationISOString: (numberOfMilliseconds: number) => string;
|
|
38
|
-
monthDayStringNumeric: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
39
|
-
sessionDurationString: (numberOfMilliseconds: number) => string;
|
|
40
|
-
timeAgoString: (date: Date, { nowAnchor }?: TimeAgoOptions) => string;
|
|
41
|
-
timeOnlyString: (date: unknown, { timeZone }?: DateOnlyStringOptions) => string;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
22
|
declare const mq: {
|
|
45
23
|
xsAndUp: () => string;
|
|
46
24
|
smAndUp: () => string;
|
|
@@ -2229,4 +2207,4 @@ type DataCardTrendProps = {
|
|
|
2229
2207
|
};
|
|
2230
2208
|
declare const DataCardTrend: ({ direction, outlook, children, ...props }: DataCardTrendProps) => JSX.Element;
|
|
2231
2209
|
|
|
2232
|
-
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard,
|
|
2210
|
+
export { ActionButton, type ActionButtonProps, Avatar, type AvatarProps, type AvatarStatus, Badge, type BadgeProps, Box, type BoxProps, Breadcrumb, type BreadcrumbProps, Breadcrumbs, type BreadcrumbsProps, Button, ButtonGroup, type ButtonProps, Card, type CardProps, Checkbox, CheckboxGroup, CheckboxMenuItem, type ColorSchemeTypes, ColorSchemeWrapper, type ColorSchemeWrapperProps, DataCard, type DataCardProps, DataCardTrend, type DataCardTrendProps, DataCards, type DataCardsProps, Divider, Ellipsis, Form, FormErrorSummary, FormField, type FormFieldProps, FormGroup, type FormGroupProps, type FormProps, Heading, type HeadingProps, Icon, IconButton, type IconButtonProps, type IconNameType, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Modal, type ModalProps, Radio, RadioGroup, RadioMenuItem, type RadioProps, ScreenReaderOnly, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, Select, SelectOption, SelectOptionGroup, type SelectOptionGroupProps, type SelectOptionProps, type SelectProps, Stack, SubMenu, Tag, type TagProps, Text, type TextProps, Tooltip, type TooltipProps, UIProvider, WistiaLogo, colorSchemeOptions, copyToClipboard, ellipsisFlexParentStyle, ellipsisStyle, iconSizeMap, mq, useActiveMq, useAriaLive, useBoolean, useFormState, useKey, useMq, useToast, useWindowSize };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.4.14
|
|
3
|
+
* @license @wistia/ui v0.4.14
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -1461,363 +1461,6 @@ var copyToClipboard = async (textToCopy) => {
|
|
|
1461
1461
|
});
|
|
1462
1462
|
};
|
|
1463
1463
|
|
|
1464
|
-
// src/helpers/dateTime/constants.ts
|
|
1465
|
-
var defaultLocales = ["en-US"];
|
|
1466
|
-
var defaultTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
1467
|
-
var secondsInMinute = 60;
|
|
1468
|
-
var minutesInHour = 60;
|
|
1469
|
-
var halfAnHourInMinutes = 30;
|
|
1470
|
-
var hoursInDay = 24;
|
|
1471
|
-
var milisecondsInSecond = 1e3;
|
|
1472
|
-
var millisecondsInDay = hoursInDay * minutesInHour * secondsInMinute * milisecondsInSecond;
|
|
1473
|
-
|
|
1474
|
-
// src/helpers/dateTime/buildTimeDuration.ts
|
|
1475
|
-
var buildTimeDuration = (numberOfMilliseconds) => {
|
|
1476
|
-
const numberOfSeconds = Math.floor(numberOfMilliseconds / milisecondsInSecond);
|
|
1477
|
-
const numberOfMinutes = Math.floor(numberOfSeconds / secondsInMinute);
|
|
1478
|
-
const numberOfHours = Math.floor(numberOfMinutes / minutesInHour);
|
|
1479
|
-
const seconds = numberOfSeconds - numberOfMinutes * secondsInMinute;
|
|
1480
|
-
const minutes = numberOfMinutes - numberOfHours * minutesInHour;
|
|
1481
|
-
return { seconds, minutes, hours: numberOfHours };
|
|
1482
|
-
};
|
|
1483
|
-
|
|
1484
|
-
// src/helpers/dateTime/isDate.ts
|
|
1485
|
-
var isDate = (date) => date instanceof Date;
|
|
1486
|
-
|
|
1487
|
-
// src/helpers/dateTime/isInvalidDate.ts
|
|
1488
|
-
var isInvalidDate = (date) => {
|
|
1489
|
-
if (!isDate(date)) {
|
|
1490
|
-
return true;
|
|
1491
|
-
}
|
|
1492
|
-
const time = date.getTime();
|
|
1493
|
-
return time === 0 || Number.isNaN(time);
|
|
1494
|
-
};
|
|
1495
|
-
|
|
1496
|
-
// src/helpers/dateTime/dateOnlyISOString.ts
|
|
1497
|
-
var dateOnlyISOString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1498
|
-
if (!isDate(date) || isInvalidDate(date)) {
|
|
1499
|
-
return "";
|
|
1500
|
-
}
|
|
1501
|
-
try {
|
|
1502
|
-
const formatter = new Intl.DateTimeFormat(defaultLocales, {
|
|
1503
|
-
year: "numeric",
|
|
1504
|
-
month: "2-digit",
|
|
1505
|
-
day: "2-digit",
|
|
1506
|
-
timeZone
|
|
1507
|
-
});
|
|
1508
|
-
const parts = formatter.formatToParts(date);
|
|
1509
|
-
const partsAsObject = parts.reduce(
|
|
1510
|
-
(map, obj) => {
|
|
1511
|
-
map[obj.type] = obj.value;
|
|
1512
|
-
return map;
|
|
1513
|
-
},
|
|
1514
|
-
{}
|
|
1515
|
-
);
|
|
1516
|
-
return `${partsAsObject.year}-${partsAsObject.month}-${partsAsObject.day}`;
|
|
1517
|
-
} catch (error) {
|
|
1518
|
-
console.error(error);
|
|
1519
|
-
return "";
|
|
1520
|
-
}
|
|
1521
|
-
};
|
|
1522
|
-
|
|
1523
|
-
// src/helpers/dateTime/dateOnlyString.ts
|
|
1524
|
-
var dateOnlyString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1525
|
-
if (!isDate(date) || isInvalidDate(date)) {
|
|
1526
|
-
return "";
|
|
1527
|
-
}
|
|
1528
|
-
try {
|
|
1529
|
-
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1530
|
-
dateStyle: "medium",
|
|
1531
|
-
timeZone
|
|
1532
|
-
}).format(date);
|
|
1533
|
-
} catch (error) {
|
|
1534
|
-
console.error(error);
|
|
1535
|
-
return "";
|
|
1536
|
-
}
|
|
1537
|
-
};
|
|
1538
|
-
|
|
1539
|
-
// src/helpers/dateTime/dateOnlyStringForSentence.ts
|
|
1540
|
-
var dateOnlyStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1541
|
-
if (!isDate(date) || isInvalidDate(date)) {
|
|
1542
|
-
return "";
|
|
1543
|
-
}
|
|
1544
|
-
try {
|
|
1545
|
-
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1546
|
-
dateStyle: "long",
|
|
1547
|
-
timeZone
|
|
1548
|
-
}).format(date);
|
|
1549
|
-
} catch (error) {
|
|
1550
|
-
console.error(error);
|
|
1551
|
-
return "";
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
|
|
1555
|
-
// src/helpers/dateTime/dateOnlyStringNumeric.ts
|
|
1556
|
-
var dateOnlyStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1557
|
-
if (!isDate(date) || isInvalidDate(date)) {
|
|
1558
|
-
return "";
|
|
1559
|
-
}
|
|
1560
|
-
try {
|
|
1561
|
-
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1562
|
-
year: "numeric",
|
|
1563
|
-
month: "2-digit",
|
|
1564
|
-
day: "2-digit",
|
|
1565
|
-
timeZone
|
|
1566
|
-
}).format(date);
|
|
1567
|
-
} catch (error) {
|
|
1568
|
-
console.error(error);
|
|
1569
|
-
return "";
|
|
1570
|
-
}
|
|
1571
|
-
};
|
|
1572
|
-
|
|
1573
|
-
// src/helpers/dateTime/dateTimeToDate.ts
|
|
1574
|
-
var dateTimeToDate = (dateTime2) => {
|
|
1575
|
-
const { year, month, dayOfMonth, hours, minutes } = dateTime2 ?? {};
|
|
1576
|
-
if (year !== void 0 && month !== void 0 && dayOfMonth !== void 0) {
|
|
1577
|
-
return new Date(year, month, dayOfMonth, hours ?? 0, minutes ?? 0);
|
|
1578
|
-
}
|
|
1579
|
-
return null;
|
|
1580
|
-
};
|
|
1581
|
-
|
|
1582
|
-
// src/helpers/dateTime/dateToDateTime.ts
|
|
1583
|
-
var dateToDateTime = (date) => {
|
|
1584
|
-
if (!isDate(date)) {
|
|
1585
|
-
return null;
|
|
1586
|
-
}
|
|
1587
|
-
return {
|
|
1588
|
-
year: date.getFullYear(),
|
|
1589
|
-
month: date.getMonth(),
|
|
1590
|
-
dayOfMonth: date.getDate(),
|
|
1591
|
-
hours: date.getHours(),
|
|
1592
|
-
minutes: date.getMinutes()
|
|
1593
|
-
};
|
|
1594
|
-
};
|
|
1595
|
-
|
|
1596
|
-
// src/helpers/dateTime/dateTimeToISO.ts
|
|
1597
|
-
var dateTimeToISO = (dateTime2) => dateTimeToDate(dateTime2)?.toISOString() ?? null;
|
|
1598
|
-
|
|
1599
|
-
// src/helpers/dateTime/dateTimeRounded.ts
|
|
1600
|
-
var dateTimeRounded = (dateTime2, toISOString = true) => {
|
|
1601
|
-
const first30Min = dateTime2.getMinutes() <= halfAnHourInMinutes;
|
|
1602
|
-
const hours = first30Min ? dateTime2.getHours() : dateTime2.getHours() + 1;
|
|
1603
|
-
const minutes = first30Min ? halfAnHourInMinutes : 0;
|
|
1604
|
-
const dateWithTime = {
|
|
1605
|
-
...dateToDateTime(dateTime2),
|
|
1606
|
-
hours,
|
|
1607
|
-
minutes
|
|
1608
|
-
};
|
|
1609
|
-
if (toISOString) {
|
|
1610
|
-
return dateTimeToISO(dateWithTime);
|
|
1611
|
-
}
|
|
1612
|
-
return dateTimeToDate(dateWithTime);
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
// src/helpers/dateTime/dateTimeString.ts
|
|
1616
|
-
import { isNil as isNil2 } from "@wistia/type-guards";
|
|
1617
|
-
var dateTimeString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1618
|
-
if (isNil2(date)) {
|
|
1619
|
-
return "";
|
|
1620
|
-
}
|
|
1621
|
-
const formattedDate = new Date(date);
|
|
1622
|
-
if (isInvalidDate(formattedDate)) {
|
|
1623
|
-
return "";
|
|
1624
|
-
}
|
|
1625
|
-
try {
|
|
1626
|
-
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1627
|
-
dateStyle: "medium",
|
|
1628
|
-
timeStyle: "short",
|
|
1629
|
-
timeZone
|
|
1630
|
-
}).format(formattedDate);
|
|
1631
|
-
} catch (error) {
|
|
1632
|
-
console.error(error);
|
|
1633
|
-
return "";
|
|
1634
|
-
}
|
|
1635
|
-
};
|
|
1636
|
-
|
|
1637
|
-
// src/helpers/dateTime/dateTimeStringForSentence.ts
|
|
1638
|
-
var dateTimeStringForSentence = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1639
|
-
if (!isDate(date) || isInvalidDate(date)) {
|
|
1640
|
-
return "";
|
|
1641
|
-
}
|
|
1642
|
-
try {
|
|
1643
|
-
const { year, month, day, hour, minute, dayPeriod } = new Intl.DateTimeFormat(defaultLocales, {
|
|
1644
|
-
month: "long",
|
|
1645
|
-
day: "numeric",
|
|
1646
|
-
year: "numeric",
|
|
1647
|
-
hour: "numeric",
|
|
1648
|
-
minute: "2-digit",
|
|
1649
|
-
timeZone
|
|
1650
|
-
}).formatToParts(date).reduce((acc, part) => {
|
|
1651
|
-
if (part.type !== "literal") {
|
|
1652
|
-
acc[part.type] = part.value;
|
|
1653
|
-
}
|
|
1654
|
-
return acc;
|
|
1655
|
-
}, {});
|
|
1656
|
-
return `${month} ${day}, ${year}, ${hour}:${minute} ${dayPeriod}`;
|
|
1657
|
-
} catch (error) {
|
|
1658
|
-
console.error(error);
|
|
1659
|
-
return "";
|
|
1660
|
-
}
|
|
1661
|
-
};
|
|
1662
|
-
|
|
1663
|
-
// src/helpers/dateTime/dateUTCOffset.ts
|
|
1664
|
-
var dateUTCOffset = (date) => {
|
|
1665
|
-
const offsetInHours = date.getTimezoneOffset() / minutesInHour * -1;
|
|
1666
|
-
const hours = Math.round(offsetInHours);
|
|
1667
|
-
const minutes = (offsetInHours - hours) * minutesInHour;
|
|
1668
|
-
const prefix = hours >= 0 ? "+" : "";
|
|
1669
|
-
const hoursString = `${hours}`.padStart(2, "0");
|
|
1670
|
-
const minutesString = `${minutes}`.padStart(2, "0");
|
|
1671
|
-
return `${prefix}${hoursString}:${minutesString}`;
|
|
1672
|
-
};
|
|
1673
|
-
|
|
1674
|
-
// src/helpers/dateTime/dayOfWeekString.ts
|
|
1675
|
-
var dayOfWeekString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1676
|
-
if (date === null) {
|
|
1677
|
-
return "";
|
|
1678
|
-
}
|
|
1679
|
-
try {
|
|
1680
|
-
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1681
|
-
weekday: "long",
|
|
1682
|
-
timeZone
|
|
1683
|
-
}).format(date);
|
|
1684
|
-
} catch (error) {
|
|
1685
|
-
console.error(error);
|
|
1686
|
-
return "";
|
|
1687
|
-
}
|
|
1688
|
-
};
|
|
1689
|
-
|
|
1690
|
-
// src/helpers/dateTime/padTimeInteger.ts
|
|
1691
|
-
var padTimeInteger = (num) => num.toString().padStart(2, "0");
|
|
1692
|
-
|
|
1693
|
-
// src/helpers/dateTime/mediaDurationString.ts
|
|
1694
|
-
var mediaDurationString = (numberOfMilliseconds) => {
|
|
1695
|
-
const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
|
|
1696
|
-
if (hours < 1) {
|
|
1697
|
-
return `${minutes}:${padTimeInteger(seconds)}`;
|
|
1698
|
-
}
|
|
1699
|
-
return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
|
|
1700
|
-
};
|
|
1701
|
-
|
|
1702
|
-
// src/helpers/dateTime/millisecondsToDurationISOString.ts
|
|
1703
|
-
var millisecondsToDurationISOString = (numberOfMilliseconds) => {
|
|
1704
|
-
const { seconds, minutes, hours } = buildTimeDuration(numberOfMilliseconds);
|
|
1705
|
-
let string = "PT";
|
|
1706
|
-
if (hours) {
|
|
1707
|
-
string += `${hours}H`;
|
|
1708
|
-
}
|
|
1709
|
-
if (minutes) {
|
|
1710
|
-
string += `${minutes}M`;
|
|
1711
|
-
}
|
|
1712
|
-
if (seconds) {
|
|
1713
|
-
string += `${seconds}S`;
|
|
1714
|
-
}
|
|
1715
|
-
if (!(seconds || minutes || hours)) {
|
|
1716
|
-
string += "0S";
|
|
1717
|
-
}
|
|
1718
|
-
return string;
|
|
1719
|
-
};
|
|
1720
|
-
|
|
1721
|
-
// src/helpers/dateTime/monthDayStringNumeric.ts
|
|
1722
|
-
var monthDayStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1723
|
-
if (!isDate(date) || isInvalidDate(date)) {
|
|
1724
|
-
return "";
|
|
1725
|
-
}
|
|
1726
|
-
try {
|
|
1727
|
-
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1728
|
-
month: "2-digit",
|
|
1729
|
-
day: "2-digit",
|
|
1730
|
-
timeZone
|
|
1731
|
-
}).format(date);
|
|
1732
|
-
} catch (error) {
|
|
1733
|
-
console.error(error);
|
|
1734
|
-
return "";
|
|
1735
|
-
}
|
|
1736
|
-
};
|
|
1737
|
-
|
|
1738
|
-
// src/helpers/dateTime/sessionDurationString.ts
|
|
1739
|
-
var sessionDurationString = (numberOfMilliseconds) => {
|
|
1740
|
-
const { hours, minutes, seconds } = buildTimeDuration(numberOfMilliseconds);
|
|
1741
|
-
return `${hours}:${padTimeInteger(minutes)}:${padTimeInteger(seconds)}`;
|
|
1742
|
-
};
|
|
1743
|
-
|
|
1744
|
-
// src/helpers/dateTime/timeAgoString.ts
|
|
1745
|
-
import { differenceInCalendarDays } from "date-fns";
|
|
1746
|
-
var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date() } = {}) => {
|
|
1747
|
-
if (isInvalidDate(date)) {
|
|
1748
|
-
return "";
|
|
1749
|
-
}
|
|
1750
|
-
const minutesAgo = (nowAnchor.valueOf() - date.valueOf()) / (secondsInMinute * milisecondsInSecond);
|
|
1751
|
-
const minutesAgoRounded = Math.round(minutesAgo);
|
|
1752
|
-
const differenceInDays = differenceInCalendarDays(nowAnchor, date);
|
|
1753
|
-
if (minutesAgo < 0) {
|
|
1754
|
-
return dateTimeString(date);
|
|
1755
|
-
}
|
|
1756
|
-
if (minutesAgo < 1) {
|
|
1757
|
-
return "< 1 minute ago";
|
|
1758
|
-
}
|
|
1759
|
-
if (minutesAgoRounded < 2) {
|
|
1760
|
-
return "1 minute ago";
|
|
1761
|
-
}
|
|
1762
|
-
if (minutesAgoRounded <= minutesInHour) {
|
|
1763
|
-
return `${minutesAgoRounded} minutes ago`;
|
|
1764
|
-
}
|
|
1765
|
-
if (differenceInDays === 0) {
|
|
1766
|
-
return `Today, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
|
|
1767
|
-
}
|
|
1768
|
-
if (differenceInDays === 1) {
|
|
1769
|
-
return `Yesterday, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
|
|
1770
|
-
}
|
|
1771
|
-
if (date.getFullYear() === nowAnchor.getFullYear()) {
|
|
1772
|
-
return Intl.DateTimeFormat(defaultLocales, {
|
|
1773
|
-
day: "numeric",
|
|
1774
|
-
month: "short",
|
|
1775
|
-
hour: "numeric",
|
|
1776
|
-
minute: "2-digit"
|
|
1777
|
-
}).format(date);
|
|
1778
|
-
}
|
|
1779
|
-
return dateTimeString(date);
|
|
1780
|
-
};
|
|
1781
|
-
|
|
1782
|
-
// src/helpers/dateTime/timeOnlyString.ts
|
|
1783
|
-
var timeOnlyString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1784
|
-
if (!isDate(date) || isInvalidDate(date)) {
|
|
1785
|
-
return "";
|
|
1786
|
-
}
|
|
1787
|
-
try {
|
|
1788
|
-
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1789
|
-
timeStyle: "short",
|
|
1790
|
-
timeZone
|
|
1791
|
-
}).format(date);
|
|
1792
|
-
} catch (error) {
|
|
1793
|
-
console.error(error);
|
|
1794
|
-
return "";
|
|
1795
|
-
}
|
|
1796
|
-
};
|
|
1797
|
-
|
|
1798
|
-
// src/helpers/dateTime/index.ts
|
|
1799
|
-
var dateTime = {
|
|
1800
|
-
buildTimeDuration,
|
|
1801
|
-
dateOnlyISOString,
|
|
1802
|
-
dateOnlyString,
|
|
1803
|
-
dateOnlyStringForSentence,
|
|
1804
|
-
dateOnlyStringNumeric,
|
|
1805
|
-
dateTimeRounded,
|
|
1806
|
-
dateTimeString,
|
|
1807
|
-
dateTimeStringForSentence,
|
|
1808
|
-
dateTimeToDate,
|
|
1809
|
-
dateTimeToISO,
|
|
1810
|
-
dateToDateTime,
|
|
1811
|
-
dateUTCOffset,
|
|
1812
|
-
dayOfWeekString,
|
|
1813
|
-
mediaDurationString,
|
|
1814
|
-
millisecondsToDurationISOString,
|
|
1815
|
-
monthDayStringNumeric,
|
|
1816
|
-
sessionDurationString,
|
|
1817
|
-
timeAgoString,
|
|
1818
|
-
timeOnlyString
|
|
1819
|
-
};
|
|
1820
|
-
|
|
1821
1464
|
// src/helpers/mq/mq.ts
|
|
1822
1465
|
import { getValueAndUnit } from "polished";
|
|
1823
1466
|
|
|
@@ -2015,10 +1658,10 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
|
|
|
2015
1658
|
|
|
2016
1659
|
// src/hooks/useAriaLive/useAriaLive.tsx
|
|
2017
1660
|
import { useContext } from "react";
|
|
2018
|
-
import { isNil as
|
|
1661
|
+
import { isNil as isNil2 } from "@wistia/type-guards";
|
|
2019
1662
|
var useAriaLive = () => {
|
|
2020
1663
|
const context = useContext(AriaLiveContext);
|
|
2021
|
-
if (
|
|
1664
|
+
if (isNil2(context)) {
|
|
2022
1665
|
throw new Error("useAriaLive must be used within an AriaLiveProvider");
|
|
2023
1666
|
}
|
|
2024
1667
|
return context;
|
|
@@ -2517,7 +2160,7 @@ var buttonSizeStyles = {
|
|
|
2517
2160
|
};
|
|
2518
2161
|
|
|
2519
2162
|
// src/components/Icon/Icon.tsx
|
|
2520
|
-
import { isNil as
|
|
2163
|
+
import { isNil as isNil3 } from "@wistia/type-guards";
|
|
2521
2164
|
import styled3 from "styled-components";
|
|
2522
2165
|
|
|
2523
2166
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -5715,13 +5358,13 @@ var Icon = ({
|
|
|
5715
5358
|
...otherProps
|
|
5716
5359
|
}) => {
|
|
5717
5360
|
const responsiveSize = useResponsiveProp(size);
|
|
5718
|
-
if (
|
|
5361
|
+
if (isNil3(type)) {
|
|
5719
5362
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
5720
5363
|
}
|
|
5721
|
-
if (
|
|
5364
|
+
if (isNil3(iconMap[type])) {
|
|
5722
5365
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
5723
5366
|
}
|
|
5724
|
-
if (
|
|
5367
|
+
if (isNil3(iconSizeMap[responsiveSize])) {
|
|
5725
5368
|
throw new Error(
|
|
5726
5369
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
5727
5370
|
);
|
|
@@ -5753,12 +5396,12 @@ Icon.displayName = "Icon";
|
|
|
5753
5396
|
|
|
5754
5397
|
// src/components/Link/Link.tsx
|
|
5755
5398
|
import { forwardRef } from "react";
|
|
5756
|
-
import { isNil as
|
|
5399
|
+
import { isNil as isNil4, isNotNil as isNotNil4, isNotUndefined as isNotUndefined2, isUndefined as isUndefined2 } from "@wistia/type-guards";
|
|
5757
5400
|
import styled4 from "styled-components";
|
|
5758
5401
|
import { Link as RouterLink, useInRouterContext } from "react-router-dom";
|
|
5759
5402
|
import { jsx as jsx161, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
5760
5403
|
var generateHref = (href, type, disabled) => {
|
|
5761
|
-
if (disabled ||
|
|
5404
|
+
if (disabled || isNil4(href)) {
|
|
5762
5405
|
return void 0;
|
|
5763
5406
|
}
|
|
5764
5407
|
let to = href;
|
|
@@ -5775,7 +5418,7 @@ var isLink = (props) => isNotUndefined2(props.href);
|
|
|
5775
5418
|
var StyledLink = styled4.a`
|
|
5776
5419
|
--link-icon-size: 14px;
|
|
5777
5420
|
|
|
5778
|
-
${({ href }) =>
|
|
5421
|
+
${({ href }) => isNil4(href) && buttonResetCss};
|
|
5779
5422
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
5780
5423
|
cursor: pointer;
|
|
5781
5424
|
font-family: var(--wui-typography-family-default);
|
|
@@ -6153,7 +5796,7 @@ ActionButton.displayName = "ActionButton";
|
|
|
6153
5796
|
|
|
6154
5797
|
// src/components/Avatar/Avatar.tsx
|
|
6155
5798
|
import { useState as useState4, useMemo as useMemo3, useEffect as useEffect3 } from "react";
|
|
6156
|
-
import { isNil as
|
|
5799
|
+
import { isNil as isNil6 } from "@wistia/type-guards";
|
|
6157
5800
|
import styled8 from "styled-components";
|
|
6158
5801
|
|
|
6159
5802
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -6196,13 +5839,13 @@ var ColorSchemeWrapper = ({
|
|
|
6196
5839
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
6197
5840
|
|
|
6198
5841
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
6199
|
-
import { isNil as
|
|
5842
|
+
import { isNil as isNil5, isString, isEmptyString } from "@wistia/type-guards";
|
|
6200
5843
|
var containsEmojiCharacter = (char) => {
|
|
6201
5844
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
6202
5845
|
return emojiRegex.test(char);
|
|
6203
5846
|
};
|
|
6204
5847
|
var formatNameForDisplay = (name) => {
|
|
6205
|
-
if (
|
|
5848
|
+
if (isNil5(name) || !isString(name) || isEmptyString(name) || containsEmojiCharacter(name)) {
|
|
6206
5849
|
return "U";
|
|
6207
5850
|
}
|
|
6208
5851
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -6265,7 +5908,7 @@ var AvatarWrapper = styled8.div`
|
|
|
6265
5908
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
6266
5909
|
`;
|
|
6267
5910
|
var chooseColorScheme = (name) => {
|
|
6268
|
-
if (
|
|
5911
|
+
if (isNil6(name) || name === "Anonymous") {
|
|
6269
5912
|
return "default";
|
|
6270
5913
|
}
|
|
6271
5914
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -6298,7 +5941,7 @@ var Avatar = ({
|
|
|
6298
5941
|
};
|
|
6299
5942
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
6300
5943
|
const avatarColor = useMemo3(() => chooseColorScheme(name), [name]);
|
|
6301
|
-
const showInitials =
|
|
5944
|
+
const showInitials = isNil6(imageUrl) || imageLoadState === "error";
|
|
6302
5945
|
return /* @__PURE__ */ jsx165(
|
|
6303
5946
|
AvatarWrapper,
|
|
6304
5947
|
{
|
|
@@ -6374,7 +6017,7 @@ Badge.displayName = "Badge";
|
|
|
6374
6017
|
// src/components/Box/Box.tsx
|
|
6375
6018
|
import { Children, cloneElement as cloneElement2, forwardRef as forwardRef5 } from "react";
|
|
6376
6019
|
import styled10 from "styled-components";
|
|
6377
|
-
import { isNotNil as isNotNil7, isNil as
|
|
6020
|
+
import { isNotNil as isNotNil7, isNil as isNil7, isRecord as isRecord3 } from "@wistia/type-guards";
|
|
6378
6021
|
|
|
6379
6022
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
6380
6023
|
var makePolymorphic = (component) => {
|
|
@@ -6447,7 +6090,7 @@ var wrapChildren = (children) => {
|
|
|
6447
6090
|
if (isNotNil7(children)) {
|
|
6448
6091
|
if (typeof children === "object" && isDev) {
|
|
6449
6092
|
return Children.map(children, (child) => {
|
|
6450
|
-
if (
|
|
6093
|
+
if (isNil7(child)) return null;
|
|
6451
6094
|
const elementParams = {};
|
|
6452
6095
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
6453
6096
|
elementParams.hasBoxParent = true;
|
|
@@ -6594,7 +6237,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
6594
6237
|
|
|
6595
6238
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
6596
6239
|
import styled13 from "styled-components";
|
|
6597
|
-
import { isNil as
|
|
6240
|
+
import { isNil as isNil8 } from "@wistia/type-guards";
|
|
6598
6241
|
import { jsx as jsx170 } from "react/jsx-runtime";
|
|
6599
6242
|
var getAlignment = (align) => {
|
|
6600
6243
|
if (align === "center") {
|
|
@@ -6634,7 +6277,7 @@ var ButtonGroup = ({
|
|
|
6634
6277
|
fullWidth = false,
|
|
6635
6278
|
...otherProps
|
|
6636
6279
|
}) => {
|
|
6637
|
-
if (
|
|
6280
|
+
if (isNil8(children)) {
|
|
6638
6281
|
return null;
|
|
6639
6282
|
}
|
|
6640
6283
|
return /* @__PURE__ */ jsx170(
|
|
@@ -6884,7 +6527,7 @@ Label.displayName = "Label";
|
|
|
6884
6527
|
|
|
6885
6528
|
// src/components/Label/LabelDescription.tsx
|
|
6886
6529
|
import styled17 from "styled-components";
|
|
6887
|
-
import { isNil as
|
|
6530
|
+
import { isNil as isNil9 } from "@wistia/type-guards";
|
|
6888
6531
|
import { jsx as jsx174 } from "react/jsx-runtime";
|
|
6889
6532
|
var StyledLabelDescription = styled17.div`
|
|
6890
6533
|
color: var(--wui-color-text-secondary);
|
|
@@ -6896,7 +6539,7 @@ var LabelDescription = ({
|
|
|
6896
6539
|
children,
|
|
6897
6540
|
...props
|
|
6898
6541
|
}) => {
|
|
6899
|
-
if (
|
|
6542
|
+
if (isNil9(children)) {
|
|
6900
6543
|
return null;
|
|
6901
6544
|
}
|
|
6902
6545
|
return /* @__PURE__ */ jsx174(StyledLabelDescription, { ...props, children });
|
|
@@ -7684,7 +7327,7 @@ IconButton.displayName = "IconButton";
|
|
|
7684
7327
|
// src/components/Input/Input.tsx
|
|
7685
7328
|
import { forwardRef as forwardRef12, cloneElement as cloneElement5, useRef as useRef6 } from "react";
|
|
7686
7329
|
import styled26, { css as css21 } from "styled-components";
|
|
7687
|
-
import { isNil as
|
|
7330
|
+
import { isNil as isNil10, isNotNil as isNotNil9 } from "@wistia/type-guards";
|
|
7688
7331
|
import { jsx as jsx186, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
7689
7332
|
var inputStyles = css21`
|
|
7690
7333
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -7787,7 +7430,7 @@ var Input = forwardRef12(
|
|
|
7787
7430
|
const internalRef = useRef6();
|
|
7788
7431
|
const ref = isValidRef(externalRef) ? externalRef : internalRef;
|
|
7789
7432
|
let leftIconToDisplay = leftIcon;
|
|
7790
|
-
if (
|
|
7433
|
+
if (isNil10(leftIcon) && type === "search") {
|
|
7791
7434
|
leftIconToDisplay = /* @__PURE__ */ jsx186(Icon, { type: "search" });
|
|
7792
7435
|
}
|
|
7793
7436
|
if (isNotNil9(leftIconToDisplay)) {
|
|
@@ -8824,7 +8467,7 @@ Radio.displayName = "Radio";
|
|
|
8824
8467
|
import { forwardRef as forwardRef19 } from "react";
|
|
8825
8468
|
import styled39 from "styled-components";
|
|
8826
8469
|
import { Root as ToggleGroupRoot } from "@radix-ui/react-toggle-group";
|
|
8827
|
-
import { isNil as
|
|
8470
|
+
import { isNil as isNil11 } from "@wistia/type-guards";
|
|
8828
8471
|
import { jsx as jsx203 } from "react/jsx-runtime";
|
|
8829
8472
|
var StyledSegmentedControl = styled39(ToggleGroupRoot)`
|
|
8830
8473
|
display: inline-flex;
|
|
@@ -8843,7 +8486,7 @@ var SegmentedControl = forwardRef19(
|
|
|
8843
8486
|
onSelectedValueChange,
|
|
8844
8487
|
...props
|
|
8845
8488
|
}, ref) => {
|
|
8846
|
-
if (
|
|
8489
|
+
if (isNil11(children)) {
|
|
8847
8490
|
return null;
|
|
8848
8491
|
}
|
|
8849
8492
|
return /* @__PURE__ */ jsx203(
|
|
@@ -8954,7 +8597,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
8954
8597
|
// src/components/Tag/Tag.tsx
|
|
8955
8598
|
import { forwardRef as forwardRef21 } from "react";
|
|
8956
8599
|
import styled41 from "styled-components";
|
|
8957
|
-
import { isNil as
|
|
8600
|
+
import { isNil as isNil12, isNotNil as isNotNil17, isNonEmptyString as isNonEmptyString4 } from "@wistia/type-guards";
|
|
8958
8601
|
import { Fragment as Fragment4, jsx as jsx204, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8959
8602
|
var TagLabel = styled41.a`
|
|
8960
8603
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -9032,10 +8675,10 @@ var StyledTag = styled41.div`
|
|
|
9032
8675
|
}
|
|
9033
8676
|
`;
|
|
9034
8677
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
9035
|
-
if (
|
|
8678
|
+
if (isNil12(onClickRemove)) {
|
|
9036
8679
|
return null;
|
|
9037
8680
|
}
|
|
9038
|
-
if (
|
|
8681
|
+
if (isNil12(onClickRemoveLabel)) {
|
|
9039
8682
|
throw new Error(
|
|
9040
8683
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
9041
8684
|
);
|
|
@@ -9728,7 +9371,6 @@ export {
|
|
|
9728
9371
|
WistiaLogo,
|
|
9729
9372
|
colorSchemeOptions,
|
|
9730
9373
|
copyToClipboard,
|
|
9731
|
-
dateTime,
|
|
9732
9374
|
ellipsisFlexParentStyle,
|
|
9733
9375
|
ellipsisStyle,
|
|
9734
9376
|
iconSizeMap,
|