@wistia/ui 0.22.9 → 0.22.10-beta.2c5e73bf.f00d270
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.d.ts +38 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1038 -308
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.22.
|
|
3
|
+
* @license @wistia/ui v0.22.10-beta.2c5e73bf.f00d270
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -13,6 +13,12 @@ import { createGlobalStyle, css, keyframes, styled } from "styled-components";
|
|
|
13
13
|
import { isArray, isBoolean, isEmptyString, isFunction, isNil, isNonEmptyArray, isNonEmptyString, isNotNil, isNotUndefined, isNumber, isRecord, isString, isUndefined } from "@wistia/type-guards";
|
|
14
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { Toaster, toast } from "sonner";
|
|
16
|
+
import { isValid } from "date-fns/isValid";
|
|
17
|
+
import { startOfToday } from "date-fns/startOfToday";
|
|
18
|
+
import { startOfTomorrow } from "date-fns/startOfTomorrow";
|
|
19
|
+
import { startOfDay } from "date-fns/startOfDay";
|
|
20
|
+
import { isPast } from "date-fns/isPast";
|
|
21
|
+
import { parse } from "date-fns/parse";
|
|
16
22
|
import { getValueAndUnit } from "polished";
|
|
17
23
|
import { useFilePicker as useFilePicker$1, useImperativeFilePicker as useImperativeFilePicker$1 } from "use-file-picker";
|
|
18
24
|
import { FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, ImageDimensionsValidator, PersistentFileAmountLimitValidator } from "use-file-picker/validators";
|
|
@@ -28,6 +34,7 @@ import * as Ariakit from "@ariakit/react";
|
|
|
28
34
|
import { matchSorter } from "match-sorter";
|
|
29
35
|
import { createPortal } from "react-dom";
|
|
30
36
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu";
|
|
37
|
+
import { DayPicker } from "react-day-picker";
|
|
31
38
|
import { ValidationError } from "yup";
|
|
32
39
|
import { Content as Content$3, Portal as Portal$2, Root as Root$6, Trigger as Trigger$3 } from "@radix-ui/react-hover-card";
|
|
33
40
|
import ReactMarkdown from "react-markdown";
|
|
@@ -871,6 +878,53 @@ const monthDayStringNumeric = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
|
871
878
|
}
|
|
872
879
|
};
|
|
873
880
|
//#endregion
|
|
881
|
+
//#region src/helpers/dateTime/parseDateString.ts
|
|
882
|
+
const MONTH_NAMES = [
|
|
883
|
+
"January",
|
|
884
|
+
"February",
|
|
885
|
+
"March",
|
|
886
|
+
"April",
|
|
887
|
+
"May",
|
|
888
|
+
"June",
|
|
889
|
+
"July",
|
|
890
|
+
"August",
|
|
891
|
+
"September",
|
|
892
|
+
"October",
|
|
893
|
+
"November",
|
|
894
|
+
"December"
|
|
895
|
+
];
|
|
896
|
+
const DATE_FORMATS = [
|
|
897
|
+
"MMM d, yyyy",
|
|
898
|
+
"MMM d",
|
|
899
|
+
"MMMM d, yyyy",
|
|
900
|
+
"MMMM d",
|
|
901
|
+
"M/d/yyyy",
|
|
902
|
+
"M/d",
|
|
903
|
+
"M-d-yyyy",
|
|
904
|
+
"M-d",
|
|
905
|
+
"yyyy-MM-dd"
|
|
906
|
+
];
|
|
907
|
+
const parseDateString = (str) => {
|
|
908
|
+
const trimmed = str.trim();
|
|
909
|
+
if (!trimmed) return null;
|
|
910
|
+
const lower = trimmed.toLowerCase();
|
|
911
|
+
if (lower === "today") return startOfToday();
|
|
912
|
+
if (lower === "tomorrow") return startOfTomorrow();
|
|
913
|
+
const monthIndex = MONTH_NAMES.findIndex((name) => name.toLowerCase().startsWith(lower));
|
|
914
|
+
if (monthIndex > -1) {
|
|
915
|
+
const today = startOfToday();
|
|
916
|
+
let date = new Date(today.getFullYear(), monthIndex, 1);
|
|
917
|
+
if (isPast(date)) date = new Date(today.getFullYear() + 1, monthIndex, 1);
|
|
918
|
+
return startOfDay(date);
|
|
919
|
+
}
|
|
920
|
+
const referenceDate = /* @__PURE__ */ new Date();
|
|
921
|
+
const parsedDate = DATE_FORMATS.map((fmt) => parse(trimmed, fmt, referenceDate)).find(isValid);
|
|
922
|
+
if (parsedDate !== void 0) return startOfDay(parsedDate);
|
|
923
|
+
const native = new Date(trimmed);
|
|
924
|
+
if (isValid(native)) return startOfDay(native);
|
|
925
|
+
return null;
|
|
926
|
+
};
|
|
927
|
+
//#endregion
|
|
874
928
|
//#region src/helpers/dateTime/sessionDurationString.ts
|
|
875
929
|
/**
|
|
876
930
|
* A string representation of a duration for a user session. Assumes that
|
|
@@ -1031,6 +1085,7 @@ const dateTime = {
|
|
|
1031
1085
|
mediaDurationString,
|
|
1032
1086
|
millisecondsToDurationISOString,
|
|
1033
1087
|
monthDayStringNumeric,
|
|
1088
|
+
parseDateString,
|
|
1034
1089
|
sessionDurationString,
|
|
1035
1090
|
timeAgoString,
|
|
1036
1091
|
timeOnlyString
|
|
@@ -2253,6 +2308,32 @@ const BoltIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
|
2253
2308
|
})
|
|
2254
2309
|
});
|
|
2255
2310
|
//#endregion
|
|
2311
|
+
//#region src/components/Icon/icons/BrandsIcon.tsx
|
|
2312
|
+
const BrandsIcon = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
2313
|
+
...props,
|
|
2314
|
+
viewBox: "0 0 16 16",
|
|
2315
|
+
fill: "none",
|
|
2316
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2317
|
+
children: [
|
|
2318
|
+
/* @__PURE__ */ jsx("path", {
|
|
2319
|
+
d: "M5.55561 1.77783H3.33339C2.47428 1.77783 1.77783 2.47428 1.77783 3.33339V5.55561C1.77783 6.41472 2.47428 7.11117 3.33339 7.11117H5.55561C6.41472 7.11117 7.11117 6.41472 7.11117 5.55561V3.33339C7.11117 2.47428 6.41472 1.77783 5.55561 1.77783Z",
|
|
2320
|
+
fill: "currentColor"
|
|
2321
|
+
}),
|
|
2322
|
+
/* @__PURE__ */ jsx("path", {
|
|
2323
|
+
d: "M12.6669 8.88892H10.4447C9.58561 8.88892 8.88916 9.58536 8.88916 10.4445V12.6667C8.88916 13.5258 9.58561 14.2222 10.4447 14.2222H12.6669C13.526 14.2222 14.2225 13.5258 14.2225 12.6667V10.4445C14.2225 9.58536 13.526 8.88892 12.6669 8.88892Z",
|
|
2324
|
+
fill: "currentColor"
|
|
2325
|
+
}),
|
|
2326
|
+
/* @__PURE__ */ jsx("path", {
|
|
2327
|
+
d: "M11.5559 7.33344C13.1514 7.33344 14.4448 6.04004 14.4448 4.44455C14.4448 2.84906 13.1514 1.55566 11.5559 1.55566C9.96039 1.55566 8.66699 2.84906 8.66699 4.44455C8.66699 6.04004 9.96039 7.33344 11.5559 7.33344Z",
|
|
2328
|
+
fill: "currentColor"
|
|
2329
|
+
}),
|
|
2330
|
+
/* @__PURE__ */ jsx("path", {
|
|
2331
|
+
d: "M4.44455 14.4445C6.04004 14.4445 7.33344 13.1511 7.33344 11.5556C7.33344 9.96015 6.04004 8.66675 4.44455 8.66675C2.84906 8.66675 1.55566 9.96015 1.55566 11.5556C1.55566 13.1511 2.84906 14.4445 4.44455 14.4445Z",
|
|
2332
|
+
fill: "currentColor"
|
|
2333
|
+
})
|
|
2334
|
+
]
|
|
2335
|
+
});
|
|
2336
|
+
//#endregion
|
|
2256
2337
|
//#region src/components/Icon/icons/BulletListIcon.tsx
|
|
2257
2338
|
const BulletListIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
2258
2339
|
...props,
|
|
@@ -3299,6 +3380,30 @@ const LeaveIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
|
3299
3380
|
})
|
|
3300
3381
|
});
|
|
3301
3382
|
//#endregion
|
|
3383
|
+
//#region src/components/Icon/icons/LibraryIcon.tsx
|
|
3384
|
+
const LibraryIcon = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
3385
|
+
...props,
|
|
3386
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3387
|
+
fill: "none",
|
|
3388
|
+
viewBox: "0 0 16 16",
|
|
3389
|
+
children: [
|
|
3390
|
+
/* @__PURE__ */ jsx("path", {
|
|
3391
|
+
fill: "currentColor",
|
|
3392
|
+
fillRule: "evenodd",
|
|
3393
|
+
d: "M14.237 1.778h.652a.667.667 0 0 1 0 1.333h-.206a3.75 3.75 0 0 0 0 2.222h.206a.667.667 0 0 1 0 1.334H5.556a2.444 2.444 0 1 1 0-4.89h8.682m-.933 3.555a5.1 5.1 0 0 1 0-2.222H5.556a1.11 1.11 0 1 0 0 2.222z",
|
|
3394
|
+
clipRule: "evenodd"
|
|
3395
|
+
}),
|
|
3396
|
+
/* @__PURE__ */ jsx("path", {
|
|
3397
|
+
fill: "currentColor",
|
|
3398
|
+
d: "M13.304 10.222a5.05 5.05 0 0 0 0 2.222h-.193a.667.667 0 0 0 0 1.334h1.777a.667.667 0 0 0 0-1.334h-.205a3.74 3.74 0 0 1 0-2.222h.206a.667.667 0 0 0 0-1.333H5.556a2.444 2.444 0 1 0 0 4.889.667.667 0 0 0 0-1.334 1.11 1.11 0 1 1 0-2.222z"
|
|
3399
|
+
}),
|
|
3400
|
+
/* @__PURE__ */ jsx("path", {
|
|
3401
|
+
fill: "currentColor",
|
|
3402
|
+
d: "M10.444 5.333H1.111a.667.667 0 0 0 0 1.334h.184c.114.364.192.742.191 1.122 0 .373-.078.742-.19 1.1H1.11a.667.667 0 0 0 0 1.333h9.333a2.446 2.446 0 0 0 2.445-2.444 2.446 2.446 0 0 0-2.445-2.445M11.111 11.555H7.555v3.111a.444.444 0 0 0 .76.315l1.018-1.018 1.019 1.018a.444.444 0 0 0 .759-.315z"
|
|
3403
|
+
})
|
|
3404
|
+
]
|
|
3405
|
+
});
|
|
3406
|
+
//#endregion
|
|
3302
3407
|
//#region src/components/Icon/icons/LightBulbIcon.tsx
|
|
3303
3408
|
const LightBulbIcon = (props) => /* @__PURE__ */ jsx("svg", {
|
|
3304
3409
|
...props,
|
|
@@ -4749,6 +4854,7 @@ const iconMap = {
|
|
|
4749
4854
|
bell: BellIcon,
|
|
4750
4855
|
bolt: BoltIcon,
|
|
4751
4856
|
"bullet-list": BulletListIcon,
|
|
4857
|
+
brands: BrandsIcon,
|
|
4752
4858
|
calendar: CalendarIcon,
|
|
4753
4859
|
"call-to-action": CallToActionIcon,
|
|
4754
4860
|
camera: CameraIcon,
|
|
@@ -4831,6 +4937,7 @@ const iconMap = {
|
|
|
4831
4937
|
keyboard: KeyboardIcon,
|
|
4832
4938
|
layout: LayoutIcon,
|
|
4833
4939
|
leave: LeaveIcon,
|
|
4940
|
+
library: LibraryIcon,
|
|
4834
4941
|
"light-bulb": LightBulbIcon,
|
|
4835
4942
|
link: LinkIcon,
|
|
4836
4943
|
list: ListIcon,
|
|
@@ -8206,23 +8313,46 @@ const inputCss = css`
|
|
|
8206
8313
|
--wui-input-line-height: 16px;
|
|
8207
8314
|
--wui-input-font-weight: var(--wui-typography-weight-body);
|
|
8208
8315
|
`;
|
|
8316
|
+
/**
|
|
8317
|
+
* Applies the shared visual styling for input-like form controls (background,
|
|
8318
|
+
* outline, focus/error/disabled states, typography). Consumes the tokens from
|
|
8319
|
+
* `inputCss`, which must be applied to the element itself or an ancestor.
|
|
8320
|
+
*/
|
|
8321
|
+
const inputShellCss = css`
|
|
8322
|
+
padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
|
|
8323
|
+
background-color: var(--wui-input-color-bg);
|
|
8324
|
+
border: none;
|
|
8325
|
+
outline: 1px solid var(--wui-input-color-border);
|
|
8326
|
+
outline-offset: -1px;
|
|
8327
|
+
border-radius: var(--wui-input-border-radius);
|
|
8328
|
+
font-size: var(--wui-input-font-size);
|
|
8329
|
+
line-height: var(--wui-input-line-height);
|
|
8330
|
+
font-weight: var(--wui-input-font-weight);
|
|
8331
|
+
color: var(--wui-input-color-text);
|
|
8332
|
+
|
|
8333
|
+
&:focus,
|
|
8334
|
+
&[aria-expanded='true'] {
|
|
8335
|
+
outline-width: 2px;
|
|
8336
|
+
outline-color: var(--wui-input-color-border-focus);
|
|
8337
|
+
outline-offset: -2px;
|
|
8338
|
+
}
|
|
8339
|
+
|
|
8340
|
+
&[aria-invalid='true'] {
|
|
8341
|
+
outline-color: var(--wui-input-color-border-error);
|
|
8342
|
+
}
|
|
8343
|
+
|
|
8344
|
+
&:disabled {
|
|
8345
|
+
outline-color: var(--wui-color-border-disabled);
|
|
8346
|
+
background-color: var(--wui-color-bg-surface-disabled);
|
|
8347
|
+
}
|
|
8348
|
+
`;
|
|
8209
8349
|
//#endregion
|
|
8210
8350
|
//#region src/components/Input/Input.tsx
|
|
8211
8351
|
const inputStyles = css`
|
|
8212
8352
|
${inputCss}
|
|
8213
8353
|
input,
|
|
8214
8354
|
textarea {
|
|
8215
|
-
|
|
8216
|
-
background-color: var(--wui-input-color-bg);
|
|
8217
|
-
border: none;
|
|
8218
|
-
outline: 1px solid var(--wui-input-color-border);
|
|
8219
|
-
outline-offset: -1px;
|
|
8220
|
-
border-radius: var(--wui-input-border-radius);
|
|
8221
|
-
font-size: var(--wui-input-font-size);
|
|
8222
|
-
line-height: var(--wui-input-line-height);
|
|
8223
|
-
font-weight: var(--wui-input-font-weight);
|
|
8224
|
-
color: var(--wui-input-color-text);
|
|
8225
|
-
|
|
8355
|
+
${inputShellCss}
|
|
8226
8356
|
&:read-only {
|
|
8227
8357
|
outline-style: dashed;
|
|
8228
8358
|
}
|
|
@@ -8231,21 +8361,6 @@ const inputStyles = css`
|
|
|
8231
8361
|
color: var(--wui-input-placeholder);
|
|
8232
8362
|
opacity: 1; /* Firefox */
|
|
8233
8363
|
}
|
|
8234
|
-
|
|
8235
|
-
&:focus {
|
|
8236
|
-
outline-width: 2px;
|
|
8237
|
-
outline-color: var(--wui-input-color-border-focus);
|
|
8238
|
-
outline-offset: -2px;
|
|
8239
|
-
}
|
|
8240
|
-
|
|
8241
|
-
&[aria-invalid='true'] {
|
|
8242
|
-
outline-color: var(--wui-input-color-border-error);
|
|
8243
|
-
}
|
|
8244
|
-
|
|
8245
|
-
&:disabled {
|
|
8246
|
-
outline-color: var(--wui-color-border-disabled);
|
|
8247
|
-
background-color: var(--wui-color-bg-surface-disabled);
|
|
8248
|
-
}
|
|
8249
8364
|
}
|
|
8250
8365
|
`;
|
|
8251
8366
|
const calculateTextareaHeight = (rows = 1) => `calc((var(--wui-input-line-height) * ${rows}) + (var(--wui-input-vertical-padding) * 2));`;
|
|
@@ -10221,69 +10336,911 @@ const DataListItemValue = (props) => {
|
|
|
10221
10336
|
};
|
|
10222
10337
|
DataListItemValue.displayName = "DataListItemValue_UI";
|
|
10223
10338
|
//#endregion
|
|
10224
|
-
//#region src/components/
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10339
|
+
//#region src/components/Popover/PopoverRoot.tsx
|
|
10340
|
+
/**
|
|
10341
|
+
* The root of a composable popover. Wrap `PopoverTrigger` (or `PopoverAnchor`)
|
|
10342
|
+
* and `PopoverContent` inside it.
|
|
10343
|
+
*
|
|
10344
|
+
* For the common "button opens a panel" case, prefer the bundled `Popover`.
|
|
10345
|
+
*/
|
|
10346
|
+
const PopoverRoot = ({ isOpen, ...props }) => /* @__PURE__ */ jsx(Root$4, {
|
|
10347
|
+
...props,
|
|
10348
|
+
...isOpen !== void 0 ? { open: isOpen } : {}
|
|
10349
|
+
});
|
|
10350
|
+
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
10351
|
+
//#endregion
|
|
10352
|
+
//#region src/components/Popover/PopoverTrigger.tsx
|
|
10353
|
+
/**
|
|
10354
|
+
* The button that toggles the popover open and closed. By default it renders a
|
|
10355
|
+
* `<button>` wrapping its children; pass `asChild` to merge the trigger
|
|
10356
|
+
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
10357
|
+
*/
|
|
10358
|
+
const PopoverTrigger = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Trigger$2, {
|
|
10359
|
+
ref: forwardedRef,
|
|
10360
|
+
...props
|
|
10361
|
+
}));
|
|
10362
|
+
PopoverTrigger.displayName = "PopoverTrigger_UI";
|
|
10363
|
+
//#endregion
|
|
10364
|
+
//#region src/components/Popover/PopoverPortal.tsx
|
|
10365
|
+
/**
|
|
10366
|
+
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
10367
|
+
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
10368
|
+
*/
|
|
10369
|
+
const PopoverPortal = (props) => /* @__PURE__ */ jsx(Portal$1, { ...props });
|
|
10370
|
+
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
10371
|
+
//#endregion
|
|
10372
|
+
//#region src/components/Popover/PopoverContent.tsx
|
|
10373
|
+
const StyledContent$2 = styled(Content$2)`
|
|
10374
|
+
z-index: var(--wui-zindex-popover);
|
|
10375
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
10376
|
+
${({ $unstyled }) => !$unstyled && css`
|
|
10377
|
+
border-radius: var(--wui-border-radius-02);
|
|
10378
|
+
padding: var(--wui-space-04);
|
|
10379
|
+
max-width: var(--wui-popover-max-width);
|
|
10380
|
+
max-height: var(--wui-popover-max-height);
|
|
10381
|
+
background-color: var(--wui-color-bg-surface);
|
|
10382
|
+
box-shadow: var(--wui-elevation-01);
|
|
10383
|
+
border: 1px solid var(--wui-color-border);
|
|
10384
|
+
overflow: auto;
|
|
10385
|
+
`}
|
|
10250
10386
|
|
|
10251
|
-
|
|
10387
|
+
[data-wui-popover-close] {
|
|
10388
|
+
position: absolute;
|
|
10389
|
+
top: var(--wui-space-02);
|
|
10390
|
+
right: var(--wui-space-02);
|
|
10391
|
+
}
|
|
10252
10392
|
`;
|
|
10393
|
+
const DEFAULT_SIDE_OFFSET = 8;
|
|
10394
|
+
const DEFAULT_MAX_WIDTH = "320px";
|
|
10395
|
+
const DEFAULT_MAX_HEIGHT = "auto";
|
|
10253
10396
|
/**
|
|
10254
|
-
*
|
|
10397
|
+
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
10398
|
+
* in a `PopoverPortal`). Forwards all Radix Content props, including
|
|
10399
|
+
* dismissal/focus event handlers such as `onPointerDownOutside`,
|
|
10400
|
+
* `onOpenAutoFocus`, and `onCloseAutoFocus`.
|
|
10255
10401
|
*/
|
|
10256
|
-
const
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
$
|
|
10260
|
-
$
|
|
10261
|
-
|
|
10262
|
-
|
|
10402
|
+
const PopoverContent = forwardRef(({ colorScheme = "inherit", unstyled = false, maxWidth = DEFAULT_MAX_WIDTH, maxHeight = DEFAULT_MAX_HEIGHT, sideOffset = DEFAULT_SIDE_OFFSET, style, ...props }, forwardedRef) => {
|
|
10403
|
+
return /* @__PURE__ */ jsx(StyledContent$2, {
|
|
10404
|
+
ref: forwardedRef,
|
|
10405
|
+
$colorScheme: colorScheme,
|
|
10406
|
+
$unstyled: unstyled,
|
|
10407
|
+
sideOffset,
|
|
10408
|
+
style: {
|
|
10409
|
+
"--wui-popover-max-width": maxWidth,
|
|
10410
|
+
"--wui-popover-max-height": maxHeight,
|
|
10411
|
+
...style
|
|
10412
|
+
},
|
|
10263
10413
|
...props
|
|
10264
10414
|
});
|
|
10265
|
-
};
|
|
10266
|
-
|
|
10415
|
+
});
|
|
10416
|
+
PopoverContent.displayName = "PopoverContent_UI";
|
|
10267
10417
|
//#endregion
|
|
10268
|
-
//#region src/components/
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10418
|
+
//#region src/components/Popover/PopoverClose.tsx
|
|
10419
|
+
/**
|
|
10420
|
+
* An element that closes the popover when activated. Defaults to a `<button>`;
|
|
10421
|
+
* pass `asChild` to merge the close behavior onto a single child element. For
|
|
10422
|
+
* a pre-styled icon close button, use `PopoverCloseButton`.
|
|
10423
|
+
*/
|
|
10424
|
+
const PopoverClose = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Close, {
|
|
10425
|
+
ref: forwardedRef,
|
|
10426
|
+
...props
|
|
10427
|
+
}));
|
|
10428
|
+
PopoverClose.displayName = "PopoverClose_UI";
|
|
10429
|
+
//#endregion
|
|
10430
|
+
//#region src/components/Popover/PopoverCloseButton.tsx
|
|
10431
|
+
/**
|
|
10432
|
+
* A pre-styled close button intended to be placed inside a `PopoverContent`.
|
|
10433
|
+
* For a custom close control, use `PopoverClose` directly.
|
|
10434
|
+
*/
|
|
10435
|
+
const PopoverCloseButton = ({ label = "Close" } = {}) => /* @__PURE__ */ jsx(PopoverClose, {
|
|
10436
|
+
asChild: true,
|
|
10437
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
10438
|
+
"data-wui-popover-close": true,
|
|
10439
|
+
label,
|
|
10440
|
+
variant: "ghost",
|
|
10441
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
10442
|
+
})
|
|
10443
|
+
});
|
|
10444
|
+
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
10445
|
+
//#endregion
|
|
10446
|
+
//#region src/components/Popover/PopoverArrow.tsx
|
|
10447
|
+
const StyledPath = styled.path`
|
|
10448
|
+
fill: var(--wui-color-border-secondary);
|
|
10449
|
+
`;
|
|
10450
|
+
const circleAnimation = keyframes`
|
|
10451
|
+
0% {
|
|
10452
|
+
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
10453
|
+
}
|
|
10454
|
+
100% {
|
|
10455
|
+
opacity: 0;
|
|
10272
10456
|
}
|
|
10457
|
+
`;
|
|
10458
|
+
const StyledCircle = styled.circle`
|
|
10459
|
+
stroke: var(--wui-color-border-active);
|
|
10460
|
+
animation-duration: 2s;
|
|
10461
|
+
animation-iteration-count: infinite;
|
|
10462
|
+
animation-direction: alternate;
|
|
10463
|
+
animation-timing-function: ease-in-out;
|
|
10273
10464
|
|
|
10274
|
-
|
|
10275
|
-
|
|
10465
|
+
&[data-wui-popover-arrow-inner-circle] {
|
|
10466
|
+
--wui-popover-arrow-circle-starting-opacity: 0.36;
|
|
10467
|
+
|
|
10468
|
+
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
10276
10469
|
}
|
|
10277
10470
|
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
/* The input font styles (edit mode) needs the same font styles as Heading */
|
|
10281
|
-
--wui-input-font-size: var(--font-size);
|
|
10282
|
-
--wui-input-font-weight: var(--font-weight);
|
|
10283
|
-
--wui-input-line-height: var(--line-height);
|
|
10471
|
+
&[data-wui-popover-arrow-outer-circle] {
|
|
10472
|
+
--wui-popover-arrow-circle-starting-opacity: 0.2;
|
|
10284
10473
|
|
|
10285
|
-
|
|
10286
|
-
|
|
10474
|
+
animation-direction: alternate-reverse;
|
|
10475
|
+
opacity: 0.11;
|
|
10476
|
+
}
|
|
10477
|
+
|
|
10478
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
10479
|
+
${({ $isAnimated }) => $isAnimated && css`
|
|
10480
|
+
animation-name: ${circleAnimation};
|
|
10481
|
+
`}
|
|
10482
|
+
}
|
|
10483
|
+
`;
|
|
10484
|
+
const PopoverArrow = ({ isAnimated }) => {
|
|
10485
|
+
return /* @__PURE__ */ jsx(PopoverArrow$1, {
|
|
10486
|
+
asChild: true,
|
|
10487
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
10488
|
+
fill: "none",
|
|
10489
|
+
height: "56",
|
|
10490
|
+
viewBox: "0 0 48 56",
|
|
10491
|
+
width: "48",
|
|
10492
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10493
|
+
children: [
|
|
10494
|
+
/* @__PURE__ */ jsx(StyledPath, { d: "M24 26.6667C21.0545 26.6667 18.6667 29.0545 18.6667 32C18.6667 34.9455 21.0545 37.3333 24 37.3333C26.9455 37.3333 29.3333 34.9455 29.3333 32C29.3333 29.0545 26.9455 26.6667 24 26.6667ZM23 0V32H25V0H23Z" }),
|
|
10495
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
10496
|
+
$isAnimated: isAnimated,
|
|
10497
|
+
cx: "24",
|
|
10498
|
+
cy: "32",
|
|
10499
|
+
"data-wui-popover-arrow-inner-circle": true,
|
|
10500
|
+
r: "10",
|
|
10501
|
+
strokeWidth: "4"
|
|
10502
|
+
}),
|
|
10503
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
10504
|
+
$isAnimated: isAnimated,
|
|
10505
|
+
cx: "24",
|
|
10506
|
+
cy: "32",
|
|
10507
|
+
"data-wui-popover-arrow-outer-circle": true,
|
|
10508
|
+
r: "20",
|
|
10509
|
+
strokeWidth: "8"
|
|
10510
|
+
})
|
|
10511
|
+
]
|
|
10512
|
+
})
|
|
10513
|
+
});
|
|
10514
|
+
};
|
|
10515
|
+
PopoverArrow.displayName = "PopoverArrow_UI";
|
|
10516
|
+
//#endregion
|
|
10517
|
+
//#region src/components/Popover/Popover.tsx
|
|
10518
|
+
/**
|
|
10519
|
+
* Displays rich content in a portal, triggered by a button.
|
|
10520
|
+
*
|
|
10521
|
+
* For more control — custom anchor, access to event handlers like
|
|
10522
|
+
* `onPointerDownOutside`, no injected close button, etc. — compose the
|
|
10523
|
+
* primitives directly: `PopoverRoot`, `PopoverTrigger`, `PopoverAnchor`,
|
|
10524
|
+
* `PopoverPortal`, `PopoverContent`, `PopoverClose`.
|
|
10525
|
+
*/
|
|
10526
|
+
const Popover = ({ children, trigger, isOpen, hideCloseButton = false, maxWidth, maxHeight, onOpenChange, unstyled = false, withArrow = false, isAnimated = false, colorScheme = "inherit", style, ...props }) => {
|
|
10527
|
+
const sideOffset = withArrow ? -24 : 8;
|
|
10528
|
+
return /* @__PURE__ */ jsxs(PopoverRoot, {
|
|
10529
|
+
...isOpen !== void 0 ? {
|
|
10530
|
+
isOpen,
|
|
10531
|
+
onOpenChange
|
|
10532
|
+
} : {},
|
|
10533
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
10534
|
+
asChild: true,
|
|
10535
|
+
children: trigger
|
|
10536
|
+
}), /* @__PURE__ */ jsx(PopoverPortal, { children: /* @__PURE__ */ jsxs(PopoverContent, {
|
|
10537
|
+
colorScheme,
|
|
10538
|
+
...maxHeight !== void 0 ? { maxHeight } : {},
|
|
10539
|
+
...maxWidth !== void 0 ? { maxWidth } : {},
|
|
10540
|
+
sideOffset,
|
|
10541
|
+
unstyled,
|
|
10542
|
+
...props,
|
|
10543
|
+
style,
|
|
10544
|
+
children: [
|
|
10545
|
+
!hideCloseButton && /* @__PURE__ */ jsx(PopoverCloseButton, {}),
|
|
10546
|
+
withArrow ? /* @__PURE__ */ jsx(PopoverArrow, { isAnimated }) : null,
|
|
10547
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
10548
|
+
]
|
|
10549
|
+
}) })]
|
|
10550
|
+
});
|
|
10551
|
+
};
|
|
10552
|
+
Popover.displayName = "Popover_UI";
|
|
10553
|
+
//#endregion
|
|
10554
|
+
//#region src/components/Popover/PopoverAnchor.tsx
|
|
10555
|
+
/**
|
|
10556
|
+
* Positions the popover relative to an element other than the trigger. Useful
|
|
10557
|
+
* when the element the user interacts with (e.g. a text input) is separate
|
|
10558
|
+
* from what the popover attaches to.
|
|
10559
|
+
*/
|
|
10560
|
+
const PopoverAnchor = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Anchor, {
|
|
10561
|
+
ref: forwardedRef,
|
|
10562
|
+
...props
|
|
10563
|
+
}));
|
|
10564
|
+
PopoverAnchor.displayName = "PopoverAnchor_UI";
|
|
10565
|
+
//#endregion
|
|
10566
|
+
//#region src/components/DatePicker/DatePickerContext.tsx
|
|
10567
|
+
const DatePickerContext = createContext(null);
|
|
10568
|
+
const DatePickerProvider = DatePickerContext.Provider;
|
|
10569
|
+
const useDatePickerContext = () => {
|
|
10570
|
+
const context = useContext(DatePickerContext);
|
|
10571
|
+
if (context === null) throw new Error("useDatePickerContext must be used within a DatePickerProvider");
|
|
10572
|
+
return context;
|
|
10573
|
+
};
|
|
10574
|
+
//#endregion
|
|
10575
|
+
//#region src/components/DatePicker/datePickerUtils.ts
|
|
10576
|
+
/**
|
|
10577
|
+
* Formats a Date into a human-readable string (e.g. "Jun 3, 2021").
|
|
10578
|
+
* Returns an empty string for null/undefined.
|
|
10579
|
+
*/
|
|
10580
|
+
const formatDate = (date) => {
|
|
10581
|
+
if (date === null) return "";
|
|
10582
|
+
return dateOnlyString(date);
|
|
10583
|
+
};
|
|
10584
|
+
/**
|
|
10585
|
+
* Formats a Date as an ISO 8601 date-only string (`YYYY-MM-DD`) in local time.
|
|
10586
|
+
* Intended for form submission — unlike the locale-formatted display string,
|
|
10587
|
+
* this is stable across locales and trivial for backends to parse.
|
|
10588
|
+
*/
|
|
10589
|
+
const toISODate = (date) => {
|
|
10590
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
10591
|
+
};
|
|
10592
|
+
const stripTime = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
10593
|
+
/**
|
|
10594
|
+
* Returns true if the date falls within the min/max range (inclusive).
|
|
10595
|
+
*/
|
|
10596
|
+
const isDateInRange = (date, minDate, maxDate) => {
|
|
10597
|
+
const dateOnly = stripTime(date);
|
|
10598
|
+
if (minDate !== void 0 && dateOnly < stripTime(minDate)) return false;
|
|
10599
|
+
if (maxDate !== void 0 && dateOnly > stripTime(maxDate)) return false;
|
|
10600
|
+
return true;
|
|
10601
|
+
};
|
|
10602
|
+
/**
|
|
10603
|
+
* Returns true if the date matches any of the disabled matchers.
|
|
10604
|
+
* Supports a subset of react-day-picker Matcher types:
|
|
10605
|
+
* - Date objects (exact match by day)
|
|
10606
|
+
* - { dayOfWeek: number[] }
|
|
10607
|
+
* - { before: Date } / { after: Date }
|
|
10608
|
+
* - { from: Date, to: Date }
|
|
10609
|
+
*/
|
|
10610
|
+
const isDateDisabled = (date, disabledDates) => {
|
|
10611
|
+
if (disabledDates === void 0) return false;
|
|
10612
|
+
const matchers = Array.isArray(disabledDates) ? disabledDates : [disabledDates];
|
|
10613
|
+
const dateOnly = stripTime(date);
|
|
10614
|
+
return matchers.some((matcher) => {
|
|
10615
|
+
if (matcher instanceof Date) return dateOnly.getTime() === stripTime(matcher).getTime();
|
|
10616
|
+
if (typeof matcher !== "object") return false;
|
|
10617
|
+
if ("dayOfWeek" in matcher && Array.isArray(matcher.dayOfWeek)) return matcher.dayOfWeek.includes(date.getDay());
|
|
10618
|
+
if ("before" in matcher && matcher.before instanceof Date) return dateOnly < stripTime(matcher.before);
|
|
10619
|
+
if ("after" in matcher && matcher.after instanceof Date) return dateOnly > stripTime(matcher.after);
|
|
10620
|
+
if ("from" in matcher && "to" in matcher) {
|
|
10621
|
+
const { from } = matcher;
|
|
10622
|
+
const { to } = matcher;
|
|
10623
|
+
if (from instanceof Date && to instanceof Date) return dateOnly >= stripTime(from) && dateOnly <= stripTime(to);
|
|
10624
|
+
}
|
|
10625
|
+
return false;
|
|
10626
|
+
});
|
|
10627
|
+
};
|
|
10628
|
+
/**
|
|
10629
|
+
* Builds a combined disabled matcher array for react-day-picker from
|
|
10630
|
+
* minDate, maxDate, and user-provided disabledDates.
|
|
10631
|
+
*/
|
|
10632
|
+
const buildDisabledMatcher = (minDate, maxDate, disabledDates) => {
|
|
10633
|
+
const matchers = [];
|
|
10634
|
+
if (minDate !== void 0) matchers.push({ before: minDate });
|
|
10635
|
+
if (maxDate !== void 0) matchers.push({ after: maxDate });
|
|
10636
|
+
if (disabledDates !== void 0) if (Array.isArray(disabledDates)) matchers.push(...disabledDates);
|
|
10637
|
+
else matchers.push(disabledDates);
|
|
10638
|
+
return matchers;
|
|
10639
|
+
};
|
|
10640
|
+
//#endregion
|
|
10641
|
+
//#region src/components/DatePicker/DatePickerInput.tsx
|
|
10642
|
+
const StyledMobileTrigger = styled.button`
|
|
10643
|
+
${inputCss}
|
|
10644
|
+
${inputShellCss}
|
|
10645
|
+
|
|
10646
|
+
display: inline-flex;
|
|
10647
|
+
align-items: center;
|
|
10648
|
+
justify-content: space-between;
|
|
10649
|
+
gap: var(--wui-space-02);
|
|
10650
|
+
width: 100%;
|
|
10651
|
+
font-family: inherit;
|
|
10652
|
+
text-align: left;
|
|
10653
|
+
cursor: pointer;
|
|
10654
|
+
|
|
10655
|
+
&:disabled {
|
|
10656
|
+
cursor: not-allowed;
|
|
10657
|
+
}
|
|
10658
|
+
|
|
10659
|
+
&[data-empty='true'] {
|
|
10660
|
+
color: var(--wui-input-placeholder);
|
|
10661
|
+
}
|
|
10662
|
+
`;
|
|
10663
|
+
const DatePickerInput = ({ placeholder = "Select a date...", fullWidth, name, id, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => {
|
|
10664
|
+
const { selectedDate, isOpen, inputText, disabled, isMobile, inputRef, popoverContentRef, setIsOpen, handleInputChange, handleCommit } = useDatePickerContext();
|
|
10665
|
+
const submittedValue = selectedDate !== null ? toISODate(selectedDate) : "";
|
|
10666
|
+
const handleClick = () => {
|
|
10667
|
+
if (!isOpen) setIsOpen(true);
|
|
10668
|
+
};
|
|
10669
|
+
if (isMobile) {
|
|
10670
|
+
const handleMobileKeyDown = (event) => {
|
|
10671
|
+
if (event.key === "Escape" && isOpen) {
|
|
10672
|
+
event.preventDefault();
|
|
10673
|
+
setIsOpen(false);
|
|
10674
|
+
}
|
|
10675
|
+
};
|
|
10676
|
+
const isEmpty = inputText.length === 0;
|
|
10677
|
+
return /* @__PURE__ */ jsxs(PopoverAnchor, { children: [/* @__PURE__ */ jsxs(StyledMobileTrigger, {
|
|
10678
|
+
ref: inputRef,
|
|
10679
|
+
"aria-describedby": ariaDescribedBy,
|
|
10680
|
+
"aria-expanded": isOpen,
|
|
10681
|
+
"aria-haspopup": "dialog",
|
|
10682
|
+
...ariaInvalid !== void 0 ? { "aria-invalid": ariaInvalid } : {},
|
|
10683
|
+
$fullWidth: fullWidth ?? false,
|
|
10684
|
+
"data-empty": isEmpty,
|
|
10685
|
+
disabled,
|
|
10686
|
+
id,
|
|
10687
|
+
type: "button",
|
|
10688
|
+
onClick: handleClick,
|
|
10689
|
+
onKeyDown: handleMobileKeyDown,
|
|
10690
|
+
children: [/* @__PURE__ */ jsx("span", { children: isEmpty ? placeholder : inputText }), /* @__PURE__ */ jsx(Icon, {
|
|
10691
|
+
type: "calendar",
|
|
10692
|
+
size: "md"
|
|
10693
|
+
})]
|
|
10694
|
+
}), name !== void 0 && /* @__PURE__ */ jsx("input", {
|
|
10695
|
+
name,
|
|
10696
|
+
type: "hidden",
|
|
10697
|
+
value: submittedValue
|
|
10698
|
+
})] });
|
|
10699
|
+
}
|
|
10700
|
+
const handleBlur = (event) => {
|
|
10701
|
+
const relatedTarget = event.relatedTarget;
|
|
10702
|
+
if (relatedTarget !== null && popoverContentRef.current?.contains(relatedTarget)) return;
|
|
10703
|
+
handleCommit();
|
|
10704
|
+
};
|
|
10705
|
+
const handleKeyDown = (event) => {
|
|
10706
|
+
if (event.key === "Enter") {
|
|
10707
|
+
event.preventDefault();
|
|
10708
|
+
handleCommit();
|
|
10709
|
+
}
|
|
10710
|
+
if (event.key === "Tab" && isOpen && popoverContentRef.current !== null) {
|
|
10711
|
+
event.preventDefault();
|
|
10712
|
+
popoverContentRef.current.focus();
|
|
10713
|
+
}
|
|
10714
|
+
if (event.key === "Escape" && isOpen) setIsOpen(false);
|
|
10715
|
+
};
|
|
10716
|
+
return /* @__PURE__ */ jsxs(PopoverAnchor, { children: [/* @__PURE__ */ jsx(Input, {
|
|
10717
|
+
ref: inputRef,
|
|
10718
|
+
"aria-describedby": ariaDescribedBy,
|
|
10719
|
+
"aria-expanded": isOpen,
|
|
10720
|
+
"aria-haspopup": "dialog",
|
|
10721
|
+
...ariaInvalid !== void 0 ? { "aria-invalid": ariaInvalid } : {},
|
|
10722
|
+
autoSelect: true,
|
|
10723
|
+
disabled,
|
|
10724
|
+
...fullWidth !== void 0 ? { fullWidth } : {},
|
|
10725
|
+
id,
|
|
10726
|
+
placeholder,
|
|
10727
|
+
rightIcon: /* @__PURE__ */ jsx(Icon, { type: "calendar" }),
|
|
10728
|
+
role: "combobox",
|
|
10729
|
+
value: inputText,
|
|
10730
|
+
onBlur: handleBlur,
|
|
10731
|
+
onChange: (event) => {
|
|
10732
|
+
handleInputChange(event.target.value);
|
|
10733
|
+
},
|
|
10734
|
+
onClick: handleClick,
|
|
10735
|
+
onKeyDown: handleKeyDown
|
|
10736
|
+
}), name !== void 0 && /* @__PURE__ */ jsx("input", {
|
|
10737
|
+
name,
|
|
10738
|
+
type: "hidden",
|
|
10739
|
+
value: submittedValue
|
|
10740
|
+
})] });
|
|
10741
|
+
};
|
|
10742
|
+
DatePickerInput.displayName = "DatePickerInput_UI";
|
|
10743
|
+
//#endregion
|
|
10744
|
+
//#region src/private/components/Calendar/CalendarNavigation.tsx
|
|
10745
|
+
const StyledNav = styled.div`
|
|
10746
|
+
position: absolute;
|
|
10747
|
+
inset-block-start: 0;
|
|
10748
|
+
inset-inline-end: 0;
|
|
10749
|
+
display: flex;
|
|
10750
|
+
align-items: center;
|
|
10751
|
+
`;
|
|
10752
|
+
const CalendarNavigation = ({ onPreviousClick, onNextClick, previousMonth, nextMonth }) => {
|
|
10753
|
+
return /* @__PURE__ */ jsxs(StyledNav, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
10754
|
+
disabled: !previousMonth,
|
|
10755
|
+
label: "Go to previous month",
|
|
10756
|
+
onClick: onPreviousClick,
|
|
10757
|
+
size: "md",
|
|
10758
|
+
variant: "ghost",
|
|
10759
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "caret-left" })
|
|
10760
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
10761
|
+
disabled: !nextMonth,
|
|
10762
|
+
label: "Go to next month",
|
|
10763
|
+
onClick: onNextClick,
|
|
10764
|
+
size: "md",
|
|
10765
|
+
variant: "ghost",
|
|
10766
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "caret-right" })
|
|
10767
|
+
})] });
|
|
10768
|
+
};
|
|
10769
|
+
CalendarNavigation.displayName = "CalendarNavigation";
|
|
10770
|
+
//#endregion
|
|
10771
|
+
//#region src/private/components/Calendar/calendarStyles.ts
|
|
10772
|
+
const calendarCss = css`
|
|
10773
|
+
/* stylelint-disable selector-class-pattern, no-descending-specificity --
|
|
10774
|
+
react-day-picker ships class names with underscores (e.g. rdp-day_button, rdp-range_start).
|
|
10775
|
+
We can't rename library classes, so the kebab-case pattern doesn't apply here. The
|
|
10776
|
+
descending-specificity rule is disabled because state rules (.rdp-today, .rdp-selected,
|
|
10777
|
+
.rdp-range_*) intentionally layer on top of the base .rdp-day_button block. */
|
|
10778
|
+
|
|
10779
|
+
/* Root */
|
|
10780
|
+
.rdp-root {
|
|
10781
|
+
--rdp-day-size: 36px;
|
|
10782
|
+
|
|
10783
|
+
font-family: var(--wui-typography-family-default);
|
|
10784
|
+
font-size: var(--wui-typography-body-3-size);
|
|
10785
|
+
font-weight: var(--wui-typography-body-3-weight);
|
|
10786
|
+
user-select: none;
|
|
10787
|
+
position: relative;
|
|
10788
|
+
}
|
|
10789
|
+
|
|
10790
|
+
/* Months layout */
|
|
10791
|
+
.rdp-months {
|
|
10792
|
+
display: flex;
|
|
10793
|
+
gap: var(--wui-space-05);
|
|
10794
|
+
}
|
|
10795
|
+
|
|
10796
|
+
.rdp-month {
|
|
10797
|
+
display: flex;
|
|
10798
|
+
flex-direction: column;
|
|
10799
|
+
}
|
|
10800
|
+
|
|
10801
|
+
/* Caption / navigation row */
|
|
10802
|
+
.rdp-month_caption {
|
|
10803
|
+
display: flex;
|
|
10804
|
+
align-items: center;
|
|
10805
|
+
justify-content: space-between;
|
|
10806
|
+
padding-left: var(--wui-space-01);
|
|
10807
|
+
}
|
|
10808
|
+
|
|
10809
|
+
.rdp-caption_label {
|
|
10810
|
+
font-family: var(--wui-typography-heading-4-family);
|
|
10811
|
+
font-weight: var(--wui-typography-heading-4-weight);
|
|
10812
|
+
font-size: var(--wui-typography-heading-4-size);
|
|
10813
|
+
line-height: var(--wui-typography-heading-4-line-height);
|
|
10814
|
+
min-height: 32px;
|
|
10815
|
+
display: flex;
|
|
10816
|
+
align-items: center;
|
|
10817
|
+
white-space: nowrap;
|
|
10818
|
+
}
|
|
10819
|
+
|
|
10820
|
+
/* Grid */
|
|
10821
|
+
.rdp-month_grid {
|
|
10822
|
+
border-collapse: collapse;
|
|
10823
|
+
border-spacing: 0;
|
|
10824
|
+
}
|
|
10825
|
+
|
|
10826
|
+
/* Weekday headers */
|
|
10827
|
+
.rdp-weekday {
|
|
10828
|
+
color: var(--wui-color-text-secondary);
|
|
10829
|
+
font-weight: var(--wui-typography-label-3-weight);
|
|
10830
|
+
font-size: var(--wui-typography-label-3-size);
|
|
10831
|
+
line-height: var(--wui-typography-label-3-line-height);
|
|
10832
|
+
text-align: center;
|
|
10833
|
+
width: var(--rdp-day-size);
|
|
10834
|
+
height: var(--rdp-day-size);
|
|
10835
|
+
padding: 0;
|
|
10836
|
+
}
|
|
10837
|
+
|
|
10838
|
+
/* Day cells */
|
|
10839
|
+
.rdp-day {
|
|
10840
|
+
width: var(--rdp-day-size);
|
|
10841
|
+
height: var(--rdp-day-size);
|
|
10842
|
+
text-align: center;
|
|
10843
|
+
padding: 0;
|
|
10844
|
+
}
|
|
10845
|
+
|
|
10846
|
+
/* Day button — base */
|
|
10847
|
+
.rdp-day_button {
|
|
10848
|
+
--rdp-day-button-size: calc(var(--rdp-day-size) - 4px);
|
|
10849
|
+
|
|
10850
|
+
display: inline-flex;
|
|
10851
|
+
align-items: center;
|
|
10852
|
+
justify-content: center;
|
|
10853
|
+
width: var(--rdp-day-button-size);
|
|
10854
|
+
height: var(--rdp-day-button-size);
|
|
10855
|
+
border: none;
|
|
10856
|
+
border-radius: var(--wui-border-radius-rounded);
|
|
10857
|
+
background: none;
|
|
10858
|
+
cursor: pointer;
|
|
10859
|
+
font-family: var(--wui-typography-label-3-family);
|
|
10860
|
+
font-size: var(--wui-typography-label-3-size);
|
|
10861
|
+
font-weight: var(--wui-typography-label-3-weight);
|
|
10862
|
+
line-height: var(--wui-typography-label-3-line-height);
|
|
10863
|
+
color: var(--wui-color-text);
|
|
10864
|
+
padding: 0;
|
|
10865
|
+
transition: background-color var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
10866
|
+
|
|
10867
|
+
&:hover:not([disabled]) {
|
|
10868
|
+
background-color: var(--wui-color-bg-surface-hover);
|
|
10869
|
+
}
|
|
10870
|
+
|
|
10871
|
+
&:focus-visible {
|
|
10872
|
+
outline: 2px solid var(--wui-color-focus-ring);
|
|
10873
|
+
outline-offset: 1px;
|
|
10874
|
+
}
|
|
10875
|
+
}
|
|
10876
|
+
|
|
10877
|
+
/* Day button — today */
|
|
10878
|
+
.rdp-today .rdp-day_button {
|
|
10879
|
+
color: var(--wui-color-text-button-blue);
|
|
10880
|
+
font-weight: var(--wui-typography-weight-label-bold);
|
|
10881
|
+
}
|
|
10882
|
+
|
|
10883
|
+
/* Day button — outside month */
|
|
10884
|
+
.rdp-outside .rdp-day_button {
|
|
10885
|
+
color: var(--wui-color-text-secondary);
|
|
10886
|
+
}
|
|
10887
|
+
|
|
10888
|
+
/* Day button — selected */
|
|
10889
|
+
.rdp-selected .rdp-day_button {
|
|
10890
|
+
background-color: var(--wui-color-bg-fill);
|
|
10891
|
+
color: var(--wui-color-text-on-fill);
|
|
10892
|
+
|
|
10893
|
+
&:hover:not([disabled]) {
|
|
10894
|
+
background-color: var(--wui-color-bg-fill-hover);
|
|
10895
|
+
}
|
|
10896
|
+
}
|
|
10897
|
+
|
|
10898
|
+
/* Day button — disabled */
|
|
10899
|
+
.rdp-disabled .rdp-day_button {
|
|
10900
|
+
color: var(--wui-color-text-disabled);
|
|
10901
|
+
font-weight: var(--wui-typography-weight-body);
|
|
10902
|
+
cursor: not-allowed;
|
|
10903
|
+
}
|
|
10904
|
+
|
|
10905
|
+
/* Day button — disabled + selected (forced state: match disabled button) */
|
|
10906
|
+
.rdp-selected.rdp-disabled .rdp-day_button {
|
|
10907
|
+
background-color: var(--wui-color-bg-surface-disabled);
|
|
10908
|
+
color: var(--wui-color-text-disabled);
|
|
10909
|
+
}
|
|
10910
|
+
|
|
10911
|
+
/* Range — cell backgrounds (the connecting band on the <td>) */
|
|
10912
|
+
.rdp-range_start {
|
|
10913
|
+
border-top-left-radius: var(--wui-border-radius-rounded);
|
|
10914
|
+
border-bottom-left-radius: var(--wui-border-radius-rounded);
|
|
10915
|
+
background-color: var(--wui-color-bg-surface-selected);
|
|
10916
|
+
}
|
|
10917
|
+
|
|
10918
|
+
.rdp-range_end {
|
|
10919
|
+
border-top-right-radius: var(--wui-border-radius-rounded);
|
|
10920
|
+
border-bottom-right-radius: var(--wui-border-radius-rounded);
|
|
10921
|
+
background-color: var(--wui-color-bg-surface-selected);
|
|
10922
|
+
}
|
|
10923
|
+
|
|
10924
|
+
.rdp-range_middle {
|
|
10925
|
+
background-color: var(--wui-color-bg-surface-selected);
|
|
10926
|
+
}
|
|
10927
|
+
|
|
10928
|
+
.rdp-range_start.rdp-range_end {
|
|
10929
|
+
background-color: transparent;
|
|
10930
|
+
}
|
|
10931
|
+
|
|
10932
|
+
/* Range — button overrides */
|
|
10933
|
+
.rdp-range_start .rdp-day_button,
|
|
10934
|
+
.rdp-range_end .rdp-day_button {
|
|
10935
|
+
background-color: var(--wui-color-bg-fill);
|
|
10936
|
+
color: var(--wui-color-text-on-fill);
|
|
10937
|
+
}
|
|
10938
|
+
|
|
10939
|
+
.rdp-range_middle .rdp-day_button {
|
|
10940
|
+
color: var(--wui-color-text-selected);
|
|
10941
|
+
background: none;
|
|
10942
|
+
|
|
10943
|
+
&:hover:not([disabled]) {
|
|
10944
|
+
background-color: var(--wui-color-bg-surface-selected-hover);
|
|
10945
|
+
}
|
|
10946
|
+
}
|
|
10947
|
+
|
|
10948
|
+
/* Hidden */
|
|
10949
|
+
.rdp-hidden {
|
|
10950
|
+
visibility: hidden;
|
|
10951
|
+
}
|
|
10952
|
+
`;
|
|
10953
|
+
//#endregion
|
|
10954
|
+
//#region src/private/components/Calendar/Calendar.tsx
|
|
10955
|
+
const StyledCalendarWrapper = styled.div`
|
|
10956
|
+
${calendarCss}
|
|
10957
|
+
`;
|
|
10958
|
+
/**
|
|
10959
|
+
* Removes keys with `undefined` values so that exactOptionalPropertyTypes
|
|
10960
|
+
* does not complain when we spread into DayPicker.
|
|
10961
|
+
*/
|
|
10962
|
+
const stripUndefined = (obj) => Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== void 0));
|
|
10963
|
+
/**
|
|
10964
|
+
* A calendar grid for selecting dates or date ranges. Built on
|
|
10965
|
+
* react-day-picker and styled with WUI design tokens.
|
|
10966
|
+
*/
|
|
10967
|
+
const Calendar = (props) => {
|
|
10968
|
+
const { mode, selected, onSelect, month, defaultMonth, onMonthChange, startMonth, endMonth, disabled, numberOfMonths = 1, showOutsideDays, weekStartsOn, today, ...rest } = props;
|
|
10969
|
+
const rangeMin = mode === "range" ? props.min : void 0;
|
|
10970
|
+
const rangeMax = mode === "range" ? props.max : void 0;
|
|
10971
|
+
const dayPickerProps = stripUndefined({
|
|
10972
|
+
...mode === "range" ? {
|
|
10973
|
+
mode: "range",
|
|
10974
|
+
selected,
|
|
10975
|
+
onSelect,
|
|
10976
|
+
min: rangeMin,
|
|
10977
|
+
max: rangeMax
|
|
10978
|
+
} : {
|
|
10979
|
+
mode: "single",
|
|
10980
|
+
selected,
|
|
10981
|
+
onSelect
|
|
10982
|
+
},
|
|
10983
|
+
components: { Nav: CalendarNavigation },
|
|
10984
|
+
defaultMonth,
|
|
10985
|
+
disabled,
|
|
10986
|
+
endMonth,
|
|
10987
|
+
month,
|
|
10988
|
+
numberOfMonths,
|
|
10989
|
+
onMonthChange,
|
|
10990
|
+
showOutsideDays,
|
|
10991
|
+
startMonth,
|
|
10992
|
+
today,
|
|
10993
|
+
weekStartsOn
|
|
10994
|
+
});
|
|
10995
|
+
return /* @__PURE__ */ jsx(StyledCalendarWrapper, {
|
|
10996
|
+
...rest,
|
|
10997
|
+
children: /* @__PURE__ */ jsx(DayPicker, { ...dayPickerProps })
|
|
10998
|
+
});
|
|
10999
|
+
};
|
|
11000
|
+
Calendar.displayName = "Calendar";
|
|
11001
|
+
//#endregion
|
|
11002
|
+
//#region src/components/DatePicker/DatePickerPopover.tsx
|
|
11003
|
+
const DatePickerPopover = () => {
|
|
11004
|
+
const { selectedDate, previewDate, displayedMonth, align, side, minDate, maxDate, disabledDates, inputRef, popoverContentRef, handleDaySelect, setDisplayedMonth, setIsOpen } = useDatePickerContext();
|
|
11005
|
+
const disabledMatcher = buildDisabledMatcher(minDate, maxDate, disabledDates);
|
|
11006
|
+
const handleOpenAutoFocus = (event) => {
|
|
11007
|
+
event.preventDefault();
|
|
11008
|
+
};
|
|
11009
|
+
const handleCloseAutoFocus = (event) => {
|
|
11010
|
+
event.preventDefault();
|
|
11011
|
+
};
|
|
11012
|
+
const handlePointerDownOutside = (event) => {
|
|
11013
|
+
const { target } = event.detail.originalEvent;
|
|
11014
|
+
if (target instanceof Node && inputRef.current?.contains(target)) event.preventDefault();
|
|
11015
|
+
};
|
|
11016
|
+
const handleKeyDown = (event) => {
|
|
11017
|
+
if (event.key === "Escape") {
|
|
11018
|
+
setIsOpen(false);
|
|
11019
|
+
inputRef.current?.focus();
|
|
11020
|
+
}
|
|
11021
|
+
};
|
|
11022
|
+
return /* @__PURE__ */ jsx(PopoverPortal, { children: /* @__PURE__ */ jsx(PopoverContent, {
|
|
11023
|
+
ref: popoverContentRef,
|
|
11024
|
+
align,
|
|
11025
|
+
maxWidth: "none",
|
|
11026
|
+
side,
|
|
11027
|
+
onCloseAutoFocus: handleCloseAutoFocus,
|
|
11028
|
+
onKeyDown: handleKeyDown,
|
|
11029
|
+
onOpenAutoFocus: handleOpenAutoFocus,
|
|
11030
|
+
onPointerDownOutside: handlePointerDownOutside,
|
|
11031
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
11032
|
+
...disabledMatcher.length > 0 ? { disabled: disabledMatcher } : {},
|
|
11033
|
+
...maxDate !== void 0 ? { endMonth: maxDate } : {},
|
|
11034
|
+
mode: "single",
|
|
11035
|
+
month: displayedMonth,
|
|
11036
|
+
selected: previewDate ?? selectedDate ?? void 0,
|
|
11037
|
+
...minDate !== void 0 ? { startMonth: minDate } : {},
|
|
11038
|
+
onMonthChange: setDisplayedMonth,
|
|
11039
|
+
onSelect: handleDaySelect
|
|
11040
|
+
})
|
|
11041
|
+
}) });
|
|
11042
|
+
};
|
|
11043
|
+
DatePickerPopover.displayName = "DatePickerPopover_UI";
|
|
11044
|
+
//#endregion
|
|
11045
|
+
//#region src/components/DatePicker/DatePicker.tsx
|
|
11046
|
+
/**
|
|
11047
|
+
* A date picker that combines a text input with natural language parsing
|
|
11048
|
+
* and a calendar popover for visual date selection.
|
|
11049
|
+
*/
|
|
11050
|
+
const DatePicker = forwardRef(({ value, onChange, defaultValue, minDate, maxDate, disabledDates, disabled = false, placeholder, fullWidth, align = "start", side = "bottom", name, id, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy, ...rest }, ref) => {
|
|
11051
|
+
const isControlled = value !== void 0;
|
|
11052
|
+
const [internalDate, setInternalDate] = useState(defaultValue ?? null);
|
|
11053
|
+
const selectedDate = isControlled ? value : internalDate;
|
|
11054
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
11055
|
+
const [inputText, setInputText] = useState(() => formatDate(selectedDate));
|
|
11056
|
+
const [previewDate, setPreviewDate] = useState(null);
|
|
11057
|
+
const [displayedMonth, setDisplayedMonth] = useState(() => selectedDate ?? /* @__PURE__ */ new Date());
|
|
11058
|
+
const inputRef = useRef(null);
|
|
11059
|
+
const popoverContentRef = useRef(null);
|
|
11060
|
+
const skipNextCommitRef = useRef(false);
|
|
11061
|
+
const { isSmAndDown } = useMq();
|
|
11062
|
+
const commitDate = useCallback((date) => {
|
|
11063
|
+
if (isControlled) onChange(date);
|
|
11064
|
+
else setInternalDate(date);
|
|
11065
|
+
setInputText(formatDate(date));
|
|
11066
|
+
setPreviewDate(null);
|
|
11067
|
+
}, [isControlled, onChange]);
|
|
11068
|
+
const handleInputChange = useCallback((text) => {
|
|
11069
|
+
setInputText(text);
|
|
11070
|
+
const parsed = parseDateString(text);
|
|
11071
|
+
if (parsed !== null) {
|
|
11072
|
+
const inRange = isDateInRange(parsed, minDate, maxDate);
|
|
11073
|
+
const isDisabled = isDateDisabled(parsed, disabledDates);
|
|
11074
|
+
if (inRange && !isDisabled) {
|
|
11075
|
+
setPreviewDate(parsed);
|
|
11076
|
+
setDisplayedMonth(parsed);
|
|
11077
|
+
} else setPreviewDate(null);
|
|
11078
|
+
} else setPreviewDate(null);
|
|
11079
|
+
}, [
|
|
11080
|
+
minDate,
|
|
11081
|
+
maxDate,
|
|
11082
|
+
disabledDates
|
|
11083
|
+
]);
|
|
11084
|
+
const handleCommit = useCallback(() => {
|
|
11085
|
+
if (previewDate !== null) {
|
|
11086
|
+
commitDate(previewDate);
|
|
11087
|
+
setIsOpen(false);
|
|
11088
|
+
return;
|
|
11089
|
+
}
|
|
11090
|
+
setInputText(formatDate(selectedDate));
|
|
11091
|
+
setPreviewDate(null);
|
|
11092
|
+
}, [
|
|
11093
|
+
previewDate,
|
|
11094
|
+
selectedDate,
|
|
11095
|
+
commitDate
|
|
11096
|
+
]);
|
|
11097
|
+
const handleDaySelect = useCallback((date) => {
|
|
11098
|
+
if (date !== void 0) {
|
|
11099
|
+
skipNextCommitRef.current = true;
|
|
11100
|
+
commitDate(date);
|
|
11101
|
+
setDisplayedMonth(date);
|
|
11102
|
+
setIsOpen(false);
|
|
11103
|
+
inputRef.current?.focus();
|
|
11104
|
+
requestAnimationFrame(() => {
|
|
11105
|
+
const input = inputRef.current;
|
|
11106
|
+
if (input instanceof HTMLInputElement) input.setSelectionRange(input.value.length, input.value.length);
|
|
11107
|
+
});
|
|
11108
|
+
}
|
|
11109
|
+
}, [commitDate]);
|
|
11110
|
+
const handleOpenChange = useCallback((open) => {
|
|
11111
|
+
if (!open) if (skipNextCommitRef.current) skipNextCommitRef.current = false;
|
|
11112
|
+
else handleCommit();
|
|
11113
|
+
setIsOpen(open);
|
|
11114
|
+
}, [handleCommit]);
|
|
11115
|
+
useEffect(() => {
|
|
11116
|
+
if (!isControlled) return;
|
|
11117
|
+
setInputText(formatDate(value));
|
|
11118
|
+
setPreviewDate(null);
|
|
11119
|
+
if (value !== null) setDisplayedMonth(value);
|
|
11120
|
+
}, [isControlled, value]);
|
|
11121
|
+
const contextValue = useMemo(() => ({
|
|
11122
|
+
selectedDate,
|
|
11123
|
+
isOpen,
|
|
11124
|
+
inputText,
|
|
11125
|
+
previewDate,
|
|
11126
|
+
displayedMonth,
|
|
11127
|
+
disabled,
|
|
11128
|
+
isMobile: isSmAndDown,
|
|
11129
|
+
align,
|
|
11130
|
+
side,
|
|
11131
|
+
minDate,
|
|
11132
|
+
maxDate,
|
|
11133
|
+
disabledDates,
|
|
11134
|
+
inputRef,
|
|
11135
|
+
popoverContentRef,
|
|
11136
|
+
setIsOpen,
|
|
11137
|
+
setInputText,
|
|
11138
|
+
handleInputChange,
|
|
11139
|
+
handleCommit,
|
|
11140
|
+
handleDaySelect,
|
|
11141
|
+
setDisplayedMonth
|
|
11142
|
+
}), [
|
|
11143
|
+
selectedDate,
|
|
11144
|
+
isOpen,
|
|
11145
|
+
inputText,
|
|
11146
|
+
previewDate,
|
|
11147
|
+
displayedMonth,
|
|
11148
|
+
disabled,
|
|
11149
|
+
isSmAndDown,
|
|
11150
|
+
align,
|
|
11151
|
+
side,
|
|
11152
|
+
minDate,
|
|
11153
|
+
maxDate,
|
|
11154
|
+
disabledDates,
|
|
11155
|
+
handleInputChange,
|
|
11156
|
+
handleCommit,
|
|
11157
|
+
handleDaySelect
|
|
11158
|
+
]);
|
|
11159
|
+
return /* @__PURE__ */ jsx("div", {
|
|
11160
|
+
ref,
|
|
11161
|
+
...rest,
|
|
11162
|
+
children: /* @__PURE__ */ jsx(PopoverRoot, {
|
|
11163
|
+
isOpen,
|
|
11164
|
+
onOpenChange: handleOpenChange,
|
|
11165
|
+
children: /* @__PURE__ */ jsxs(DatePickerProvider, {
|
|
11166
|
+
value: contextValue,
|
|
11167
|
+
children: [/* @__PURE__ */ jsx(DatePickerInput, {
|
|
11168
|
+
"aria-describedby": ariaDescribedBy,
|
|
11169
|
+
"aria-invalid": ariaInvalid,
|
|
11170
|
+
fullWidth,
|
|
11171
|
+
id,
|
|
11172
|
+
name,
|
|
11173
|
+
placeholder
|
|
11174
|
+
}), /* @__PURE__ */ jsx(DatePickerPopover, {})]
|
|
11175
|
+
})
|
|
11176
|
+
})
|
|
11177
|
+
});
|
|
11178
|
+
});
|
|
11179
|
+
DatePicker.displayName = "DatePicker_UI";
|
|
11180
|
+
//#endregion
|
|
11181
|
+
//#region src/components/Divider/Divider.tsx
|
|
11182
|
+
const horizontalBorderCss = css`
|
|
11183
|
+
border-top-color: var(--wui-color-border);
|
|
11184
|
+
border-top-style: solid;
|
|
11185
|
+
border-top-width: 1px;
|
|
11186
|
+
clear: both; /* for horizontal dividers, ensure it clears any floats */
|
|
11187
|
+
height: 0;
|
|
11188
|
+
margin-left: var(--wui-divider-inset);
|
|
11189
|
+
margin-right: var(--wui-divider-inset);
|
|
11190
|
+
`;
|
|
11191
|
+
const verticalBorderCss = css`
|
|
11192
|
+
background-color: var(--wui-color-border);
|
|
11193
|
+
max-width: 1px;
|
|
11194
|
+
min-height: 100%;
|
|
11195
|
+
width: 1px;
|
|
11196
|
+
margin-top: var(--wui-divider-inset);
|
|
11197
|
+
margin-bottom: var(--wui-divider-inset);
|
|
11198
|
+
`;
|
|
11199
|
+
const DividerComponent = styled.div`
|
|
11200
|
+
${({ $orientation }) => {
|
|
11201
|
+
switch ($orientation) {
|
|
11202
|
+
case "vertical": return verticalBorderCss;
|
|
11203
|
+
default: return horizontalBorderCss;
|
|
11204
|
+
}
|
|
11205
|
+
}}
|
|
11206
|
+
--wui-divider-inset: ${({ $inset }) => `var(--wui-${$inset})`};
|
|
11207
|
+
|
|
11208
|
+
align-self: stretch;
|
|
11209
|
+
`;
|
|
11210
|
+
/**
|
|
11211
|
+
* A line used to visually separate content; note that dividers have no external margin/spacing on their own.
|
|
11212
|
+
*/
|
|
11213
|
+
const Divider = ({ orientation = "horizontal", inset = "space-00", ...props }) => {
|
|
11214
|
+
const responsiveOrientation = useResponsiveProp(orientation);
|
|
11215
|
+
return /* @__PURE__ */ jsx(DividerComponent, {
|
|
11216
|
+
$inset: useResponsiveProp(inset),
|
|
11217
|
+
$orientation: responsiveOrientation,
|
|
11218
|
+
"aria-orientation": responsiveOrientation,
|
|
11219
|
+
role: "separator",
|
|
11220
|
+
...props
|
|
11221
|
+
});
|
|
11222
|
+
};
|
|
11223
|
+
Divider.displayName = "Divider_UI";
|
|
11224
|
+
//#endregion
|
|
11225
|
+
//#region src/components/EditableHeading/EditableHeading.tsx
|
|
11226
|
+
const StyledInput$1 = styled(Input)`
|
|
11227
|
+
&:not([rows]) {
|
|
11228
|
+
min-height: unset;
|
|
11229
|
+
}
|
|
11230
|
+
|
|
11231
|
+
&:focus {
|
|
11232
|
+
height: ${({ $height }) => `${$height}px !important`};
|
|
11233
|
+
}
|
|
11234
|
+
|
|
11235
|
+
&& {
|
|
11236
|
+
${({ $variant }) => variantStyleMap$1[$variant]}
|
|
11237
|
+
/* The input font styles (edit mode) needs the same font styles as Heading */
|
|
11238
|
+
--wui-input-font-size: var(--font-size);
|
|
11239
|
+
--wui-input-font-weight: var(--font-weight);
|
|
11240
|
+
--wui-input-line-height: var(--line-height);
|
|
11241
|
+
|
|
11242
|
+
font-family: var(--font-family);
|
|
11243
|
+
width: 100%;
|
|
10287
11244
|
padding: var(--wui-space-02);
|
|
10288
11245
|
border: none;
|
|
10289
11246
|
height: ${({ $height }) => `${$height}px`};
|
|
@@ -11306,7 +12263,7 @@ const previewCardClose = keyframes`
|
|
|
11306
12263
|
transform: scale(0.96);
|
|
11307
12264
|
}
|
|
11308
12265
|
`;
|
|
11309
|
-
const StyledContent$
|
|
12266
|
+
const StyledContent$1 = styled(Content$3)`
|
|
11310
12267
|
--preview-card-animation-duration: var(--wui-motion-duration-03);
|
|
11311
12268
|
--preview-card-animation-ease: var(--wui-motion-ease-out);
|
|
11312
12269
|
|
|
@@ -11353,7 +12310,7 @@ const PreviewCard = ({ children, trigger, maxWidth = "320px", maxHeight = "auto"
|
|
|
11353
12310
|
children: [/* @__PURE__ */ jsx(Trigger$3, {
|
|
11354
12311
|
asChild: true,
|
|
11355
12312
|
children: trigger
|
|
11356
|
-
}), /* @__PURE__ */ jsx(Portal$2, { children: /* @__PURE__ */ jsx(StyledContent$
|
|
12313
|
+
}), /* @__PURE__ */ jsx(Portal$2, { children: /* @__PURE__ */ jsx(StyledContent$1, {
|
|
11357
12314
|
$colorScheme: colorScheme,
|
|
11358
12315
|
$paddingSize: paddingSize,
|
|
11359
12316
|
sideOffset: 8,
|
|
@@ -12351,233 +13308,6 @@ const ModalCallout = ({ title, image, children }) => {
|
|
|
12351
13308
|
};
|
|
12352
13309
|
ModalCallout.displayName = "ModalCallout_UI";
|
|
12353
13310
|
//#endregion
|
|
12354
|
-
//#region src/components/Popover/PopoverRoot.tsx
|
|
12355
|
-
/**
|
|
12356
|
-
* The root of a composable popover. Wrap `PopoverTrigger` (or `PopoverAnchor`)
|
|
12357
|
-
* and `PopoverContent` inside it.
|
|
12358
|
-
*
|
|
12359
|
-
* For the common "button opens a panel" case, prefer the bundled `Popover`.
|
|
12360
|
-
*/
|
|
12361
|
-
const PopoverRoot = ({ isOpen, ...props }) => /* @__PURE__ */ jsx(Root$4, {
|
|
12362
|
-
...props,
|
|
12363
|
-
...isOpen !== void 0 ? { open: isOpen } : {}
|
|
12364
|
-
});
|
|
12365
|
-
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
12366
|
-
//#endregion
|
|
12367
|
-
//#region src/components/Popover/PopoverTrigger.tsx
|
|
12368
|
-
/**
|
|
12369
|
-
* The button that toggles the popover open and closed. By default it renders a
|
|
12370
|
-
* `<button>` wrapping its children; pass `asChild` to merge the trigger
|
|
12371
|
-
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
12372
|
-
*/
|
|
12373
|
-
const PopoverTrigger = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Trigger$2, {
|
|
12374
|
-
ref: forwardedRef,
|
|
12375
|
-
...props
|
|
12376
|
-
}));
|
|
12377
|
-
PopoverTrigger.displayName = "PopoverTrigger_UI";
|
|
12378
|
-
//#endregion
|
|
12379
|
-
//#region src/components/Popover/PopoverPortal.tsx
|
|
12380
|
-
/**
|
|
12381
|
-
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
12382
|
-
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
12383
|
-
*/
|
|
12384
|
-
const PopoverPortal = (props) => /* @__PURE__ */ jsx(Portal$1, { ...props });
|
|
12385
|
-
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
12386
|
-
//#endregion
|
|
12387
|
-
//#region src/components/Popover/PopoverContent.tsx
|
|
12388
|
-
const StyledContent$1 = styled(Content$2)`
|
|
12389
|
-
z-index: var(--wui-zindex-popover);
|
|
12390
|
-
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
12391
|
-
${({ $unstyled }) => !$unstyled && css`
|
|
12392
|
-
border-radius: var(--wui-border-radius-02);
|
|
12393
|
-
padding: var(--wui-space-04);
|
|
12394
|
-
max-width: var(--wui-popover-max-width);
|
|
12395
|
-
max-height: var(--wui-popover-max-height);
|
|
12396
|
-
background-color: var(--wui-color-bg-surface);
|
|
12397
|
-
box-shadow: var(--wui-elevation-01);
|
|
12398
|
-
border: 1px solid var(--wui-color-border);
|
|
12399
|
-
overflow: auto;
|
|
12400
|
-
`}
|
|
12401
|
-
|
|
12402
|
-
[data-wui-popover-close] {
|
|
12403
|
-
position: absolute;
|
|
12404
|
-
top: var(--wui-space-02);
|
|
12405
|
-
right: var(--wui-space-02);
|
|
12406
|
-
}
|
|
12407
|
-
`;
|
|
12408
|
-
const DEFAULT_SIDE_OFFSET = 8;
|
|
12409
|
-
const DEFAULT_MAX_WIDTH = "320px";
|
|
12410
|
-
const DEFAULT_MAX_HEIGHT = "auto";
|
|
12411
|
-
/**
|
|
12412
|
-
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
12413
|
-
* in a `PopoverPortal`). Forwards all Radix Content props, including
|
|
12414
|
-
* dismissal/focus event handlers such as `onPointerDownOutside`,
|
|
12415
|
-
* `onOpenAutoFocus`, and `onCloseAutoFocus`.
|
|
12416
|
-
*/
|
|
12417
|
-
const PopoverContent = forwardRef(({ colorScheme = "inherit", unstyled = false, maxWidth = DEFAULT_MAX_WIDTH, maxHeight = DEFAULT_MAX_HEIGHT, sideOffset = DEFAULT_SIDE_OFFSET, style, ...props }, forwardedRef) => {
|
|
12418
|
-
return /* @__PURE__ */ jsx(StyledContent$1, {
|
|
12419
|
-
ref: forwardedRef,
|
|
12420
|
-
$colorScheme: colorScheme,
|
|
12421
|
-
$unstyled: unstyled,
|
|
12422
|
-
sideOffset,
|
|
12423
|
-
style: {
|
|
12424
|
-
"--wui-popover-max-width": maxWidth,
|
|
12425
|
-
"--wui-popover-max-height": maxHeight,
|
|
12426
|
-
...style
|
|
12427
|
-
},
|
|
12428
|
-
...props
|
|
12429
|
-
});
|
|
12430
|
-
});
|
|
12431
|
-
PopoverContent.displayName = "PopoverContent_UI";
|
|
12432
|
-
//#endregion
|
|
12433
|
-
//#region src/components/Popover/PopoverClose.tsx
|
|
12434
|
-
/**
|
|
12435
|
-
* An element that closes the popover when activated. Defaults to a `<button>`;
|
|
12436
|
-
* pass `asChild` to merge the close behavior onto a single child element. For
|
|
12437
|
-
* a pre-styled icon close button, use `PopoverCloseButton`.
|
|
12438
|
-
*/
|
|
12439
|
-
const PopoverClose = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Close, {
|
|
12440
|
-
ref: forwardedRef,
|
|
12441
|
-
...props
|
|
12442
|
-
}));
|
|
12443
|
-
PopoverClose.displayName = "PopoverClose_UI";
|
|
12444
|
-
//#endregion
|
|
12445
|
-
//#region src/components/Popover/PopoverCloseButton.tsx
|
|
12446
|
-
/**
|
|
12447
|
-
* A pre-styled close button intended to be placed inside a `PopoverContent`.
|
|
12448
|
-
* For a custom close control, use `PopoverClose` directly.
|
|
12449
|
-
*/
|
|
12450
|
-
const PopoverCloseButton = ({ label = "Close" } = {}) => /* @__PURE__ */ jsx(PopoverClose, {
|
|
12451
|
-
asChild: true,
|
|
12452
|
-
children: /* @__PURE__ */ jsx(IconButton, {
|
|
12453
|
-
"data-wui-popover-close": true,
|
|
12454
|
-
label,
|
|
12455
|
-
variant: "ghost",
|
|
12456
|
-
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12457
|
-
})
|
|
12458
|
-
});
|
|
12459
|
-
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
12460
|
-
//#endregion
|
|
12461
|
-
//#region src/components/Popover/PopoverArrow.tsx
|
|
12462
|
-
const StyledPath = styled.path`
|
|
12463
|
-
fill: var(--wui-color-border-secondary);
|
|
12464
|
-
`;
|
|
12465
|
-
const circleAnimation = keyframes`
|
|
12466
|
-
0% {
|
|
12467
|
-
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
12468
|
-
}
|
|
12469
|
-
100% {
|
|
12470
|
-
opacity: 0;
|
|
12471
|
-
}
|
|
12472
|
-
`;
|
|
12473
|
-
const StyledCircle = styled.circle`
|
|
12474
|
-
stroke: var(--wui-color-border-active);
|
|
12475
|
-
animation-duration: 2s;
|
|
12476
|
-
animation-iteration-count: infinite;
|
|
12477
|
-
animation-direction: alternate;
|
|
12478
|
-
animation-timing-function: ease-in-out;
|
|
12479
|
-
|
|
12480
|
-
&[data-wui-popover-arrow-inner-circle] {
|
|
12481
|
-
--wui-popover-arrow-circle-starting-opacity: 0.36;
|
|
12482
|
-
|
|
12483
|
-
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
12484
|
-
}
|
|
12485
|
-
|
|
12486
|
-
&[data-wui-popover-arrow-outer-circle] {
|
|
12487
|
-
--wui-popover-arrow-circle-starting-opacity: 0.2;
|
|
12488
|
-
|
|
12489
|
-
animation-direction: alternate-reverse;
|
|
12490
|
-
opacity: 0.11;
|
|
12491
|
-
}
|
|
12492
|
-
|
|
12493
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
12494
|
-
${({ $isAnimated }) => $isAnimated && css`
|
|
12495
|
-
animation-name: ${circleAnimation};
|
|
12496
|
-
`}
|
|
12497
|
-
}
|
|
12498
|
-
`;
|
|
12499
|
-
const PopoverArrow = ({ isAnimated }) => {
|
|
12500
|
-
return /* @__PURE__ */ jsx(PopoverArrow$1, {
|
|
12501
|
-
asChild: true,
|
|
12502
|
-
children: /* @__PURE__ */ jsxs("svg", {
|
|
12503
|
-
fill: "none",
|
|
12504
|
-
height: "56",
|
|
12505
|
-
viewBox: "0 0 48 56",
|
|
12506
|
-
width: "48",
|
|
12507
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12508
|
-
children: [
|
|
12509
|
-
/* @__PURE__ */ jsx(StyledPath, { d: "M24 26.6667C21.0545 26.6667 18.6667 29.0545 18.6667 32C18.6667 34.9455 21.0545 37.3333 24 37.3333C26.9455 37.3333 29.3333 34.9455 29.3333 32C29.3333 29.0545 26.9455 26.6667 24 26.6667ZM23 0V32H25V0H23Z" }),
|
|
12510
|
-
/* @__PURE__ */ jsx(StyledCircle, {
|
|
12511
|
-
$isAnimated: isAnimated,
|
|
12512
|
-
cx: "24",
|
|
12513
|
-
cy: "32",
|
|
12514
|
-
"data-wui-popover-arrow-inner-circle": true,
|
|
12515
|
-
r: "10",
|
|
12516
|
-
strokeWidth: "4"
|
|
12517
|
-
}),
|
|
12518
|
-
/* @__PURE__ */ jsx(StyledCircle, {
|
|
12519
|
-
$isAnimated: isAnimated,
|
|
12520
|
-
cx: "24",
|
|
12521
|
-
cy: "32",
|
|
12522
|
-
"data-wui-popover-arrow-outer-circle": true,
|
|
12523
|
-
r: "20",
|
|
12524
|
-
strokeWidth: "8"
|
|
12525
|
-
})
|
|
12526
|
-
]
|
|
12527
|
-
})
|
|
12528
|
-
});
|
|
12529
|
-
};
|
|
12530
|
-
PopoverArrow.displayName = "PopoverArrow_UI";
|
|
12531
|
-
//#endregion
|
|
12532
|
-
//#region src/components/Popover/Popover.tsx
|
|
12533
|
-
/**
|
|
12534
|
-
* Displays rich content in a portal, triggered by a button.
|
|
12535
|
-
*
|
|
12536
|
-
* For more control — custom anchor, access to event handlers like
|
|
12537
|
-
* `onPointerDownOutside`, no injected close button, etc. — compose the
|
|
12538
|
-
* primitives directly: `PopoverRoot`, `PopoverTrigger`, `PopoverAnchor`,
|
|
12539
|
-
* `PopoverPortal`, `PopoverContent`, `PopoverClose`.
|
|
12540
|
-
*/
|
|
12541
|
-
const Popover = ({ children, trigger, isOpen, hideCloseButton = false, maxWidth, maxHeight, onOpenChange, unstyled = false, withArrow = false, isAnimated = false, colorScheme = "inherit", style, ...props }) => {
|
|
12542
|
-
const sideOffset = withArrow ? -24 : 8;
|
|
12543
|
-
return /* @__PURE__ */ jsxs(PopoverRoot, {
|
|
12544
|
-
...isOpen !== void 0 ? {
|
|
12545
|
-
isOpen,
|
|
12546
|
-
onOpenChange
|
|
12547
|
-
} : {},
|
|
12548
|
-
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
12549
|
-
asChild: true,
|
|
12550
|
-
children: trigger
|
|
12551
|
-
}), /* @__PURE__ */ jsx(PopoverPortal, { children: /* @__PURE__ */ jsxs(PopoverContent, {
|
|
12552
|
-
colorScheme,
|
|
12553
|
-
...maxHeight !== void 0 ? { maxHeight } : {},
|
|
12554
|
-
...maxWidth !== void 0 ? { maxWidth } : {},
|
|
12555
|
-
sideOffset,
|
|
12556
|
-
unstyled,
|
|
12557
|
-
...props,
|
|
12558
|
-
style,
|
|
12559
|
-
children: [
|
|
12560
|
-
!hideCloseButton && /* @__PURE__ */ jsx(PopoverCloseButton, {}),
|
|
12561
|
-
withArrow ? /* @__PURE__ */ jsx(PopoverArrow, { isAnimated }) : null,
|
|
12562
|
-
/* @__PURE__ */ jsx("div", { children })
|
|
12563
|
-
]
|
|
12564
|
-
}) })]
|
|
12565
|
-
});
|
|
12566
|
-
};
|
|
12567
|
-
Popover.displayName = "Popover_UI";
|
|
12568
|
-
//#endregion
|
|
12569
|
-
//#region src/components/Popover/PopoverAnchor.tsx
|
|
12570
|
-
/**
|
|
12571
|
-
* Positions the popover relative to an element other than the trigger. Useful
|
|
12572
|
-
* when the element the user interacts with (e.g. a text input) is separate
|
|
12573
|
-
* from what the popover attaches to.
|
|
12574
|
-
*/
|
|
12575
|
-
const PopoverAnchor = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Anchor, {
|
|
12576
|
-
ref: forwardedRef,
|
|
12577
|
-
...props
|
|
12578
|
-
}));
|
|
12579
|
-
PopoverAnchor.displayName = "PopoverAnchor_UI";
|
|
12580
|
-
//#endregion
|
|
12581
13311
|
//#region src/components/ProgressBar/ProgressBar.tsx
|
|
12582
13312
|
const ProgressBarWrapper = styled.div`
|
|
12583
13313
|
--progress-bar-height: 8px;
|
|
@@ -14524,6 +15254,6 @@ const WistiaLogo = ({ description = void 0, height = 100, hoverColor = void 0, h
|
|
|
14524
15254
|
};
|
|
14525
15255
|
WistiaLogo.displayName = "WistiaLogo_UI";
|
|
14526
15256
|
//#endregion
|
|
14527
|
-
export { ActionButton, Avatar, Badge, Banner, Box, Breadcrumb, Breadcrumbs, Button, ButtonGroup, Card, Center, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickRegion, Collapsible, CollapsibleContent, CollapsibleTrigger, CollapsibleTriggerIcon, ColorGrid, ColorGridOption, ColorList, ColorListGroup, ColorListOption, ColorPicker, ColorPickerPopoverContent, ColorPickerSection, ColorPickerTrigger, ColorSchemeWrapper, Combobox, ComboboxOption, ContextMenu, ContrastControls, CustomizableThemeWrapper, DataCard, DataCardHoverArrow, DataCardTrend, DataCards, DataList, DataListItem, DataListItemLabel, DataListItemValue, Divider, EditableHeading, EditableText, EditableTextCancelButton, EditableTextContext, EditableTextDisplay, EditableTextInput, EditableTextLabel, EditableTextRoot, EditableTextSubmitButton, EditableTextTrigger, Ellipsis, FeatureCard, FeatureCardImage, FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, FilterMenu, FilterMenuItem, Form, FormErrorSummary, FormField, FormGroup, Grid, Heading, HexColorInput, HueSlider, Icon, IconButton, Image, ImageDimensionsValidator, Input, InputClickToCopy, InputPassword, KeyboardShortcut, Label, Link, List, ListItem, Mark, Markdown, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Meter, Modal, ModalCallout, ModalCallouts, PersistentFileAmountLimitValidator, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverCloseButton, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, PreviewCard, ProgressBar, Radio, RadioCard, RadioCardImage, RadioGroup, RadioMenuItem, SaturationAndValuePicker, ScreenReaderOnly, ScrollArea, SegmentedControl, SegmentedControlItem, Select, SelectOption, SelectOptionGroup, Slider, SplitButton, Stack, SubMenu, Switch, Table, TableBody, TableCell, TableFoot, TableHead, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Text, Thumbnail, ThumbnailBadge, ThumbnailCollage, Tooltip, UIProvider, ValueNameOrHexCode, ValueSwatch, WistiaLogo, calculateContrast, coerceToBoolean, colorSchemeOptions, copyToClipboard, dateTime, iconSizeMap, isKeyboardKey, mergeRefs, mq, useActiveMq, useAriaLive, useBoolean, useClipboard, useElementObserver, useFilePicker, useFocusTrap, useForceUpdate, useFormState, useImperativeFilePicker, useIsHovered, useKey, useKeyPress, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, usePreviousValue, useToast, useWindowSize, validateWithYup };
|
|
15257
|
+
export { ActionButton, Avatar, Badge, Banner, Box, Breadcrumb, Breadcrumbs, Button, ButtonGroup, Card, Center, Checkbox, CheckboxGroup, CheckboxMenuItem, ClickRegion, Collapsible, CollapsibleContent, CollapsibleTrigger, CollapsibleTriggerIcon, ColorGrid, ColorGridOption, ColorList, ColorListGroup, ColorListOption, ColorPicker, ColorPickerPopoverContent, ColorPickerSection, ColorPickerTrigger, ColorSchemeWrapper, Combobox, ComboboxOption, ContextMenu, ContrastControls, CustomizableThemeWrapper, DataCard, DataCardHoverArrow, DataCardTrend, DataCards, DataList, DataListItem, DataListItemLabel, DataListItemValue, DatePicker, Divider, EditableHeading, EditableText, EditableTextCancelButton, EditableTextContext, EditableTextDisplay, EditableTextInput, EditableTextLabel, EditableTextRoot, EditableTextSubmitButton, EditableTextTrigger, Ellipsis, FeatureCard, FeatureCardImage, FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, FilterMenu, FilterMenuItem, Form, FormErrorSummary, FormField, FormGroup, Grid, Heading, HexColorInput, HueSlider, Icon, IconButton, Image, ImageDimensionsValidator, Input, InputClickToCopy, InputPassword, KeyboardShortcut, Label, Link, List, ListItem, Mark, Markdown, Menu, MenuItem, MenuItemDescription, MenuItemLabel, MenuLabel, MenuRadioGroup, Meter, Modal, ModalCallout, ModalCallouts, PersistentFileAmountLimitValidator, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverCloseButton, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, PreviewCard, ProgressBar, Radio, RadioCard, RadioCardImage, RadioGroup, RadioMenuItem, SaturationAndValuePicker, ScreenReaderOnly, ScrollArea, SegmentedControl, SegmentedControlItem, Select, SelectOption, SelectOptionGroup, Slider, SplitButton, Stack, SubMenu, Switch, Table, TableBody, TableCell, TableFoot, TableHead, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Text, Thumbnail, ThumbnailBadge, ThumbnailCollage, Tooltip, UIProvider, ValueNameOrHexCode, ValueSwatch, WistiaLogo, calculateContrast, coerceToBoolean, colorSchemeOptions, copyToClipboard, dateTime, iconSizeMap, isKeyboardKey, mergeRefs, mq, useActiveMq, useAriaLive, useBoolean, useClipboard, useElementObserver, useFilePicker, useFocusTrap, useForceUpdate, useFormState, useImperativeFilePicker, useIsHovered, useKey, useKeyPress, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, usePreviousValue, useToast, useWindowSize, validateWithYup };
|
|
14528
15258
|
|
|
14529
15259
|
//# sourceMappingURL=index.js.map
|