@wistia/ui 0.26.8-beta.e6adee61.1fbb76a → 0.26.8-beta.fa7aa90d.c8edadf
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 +3 -36
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1119 -1770
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.26.8-beta.
|
|
3
|
+
* @license @wistia/ui v0.26.8-beta.fa7aa90d.c8edadf
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
11
|
-
import { Children, cloneElement, createContext,
|
|
11
|
+
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useTransition } from "react";
|
|
12
12
|
import { createGlobalStyle, css, keyframes, styled } from "styled-components";
|
|
13
13
|
import { isArray, isBoolean, isDate, 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";
|
|
@@ -37,7 +37,6 @@ import { matchSorter } from "match-sorter";
|
|
|
37
37
|
import { createPortal } from "react-dom";
|
|
38
38
|
import { ContextMenu as ContextMenu$1 } from "@base-ui/react/context-menu";
|
|
39
39
|
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
40
|
-
import { DayPicker } from "@daypicker/react";
|
|
41
40
|
import { ValidationError } from "yup";
|
|
42
41
|
import { PreviewCard as PreviewCard$1 } from "@base-ui/react/preview-card";
|
|
43
42
|
import ReactMarkdown from "react-markdown";
|
|
@@ -5657,6 +5656,7 @@ const StyledButton$2 = styled.button`
|
|
|
5657
5656
|
${({ $variant }) => buttonVariantsStyles[$variant]}
|
|
5658
5657
|
${({ $unstyled }) => !$unstyled && buttonBaseStyles}
|
|
5659
5658
|
${({ $fullWidth }) => $fullWidth && "width: 100%;"}
|
|
5659
|
+
align-self: flex-start;
|
|
5660
5660
|
text-align: center;
|
|
5661
5661
|
`;
|
|
5662
5662
|
const StyledButtonContent = styled.div`
|
|
@@ -6617,6 +6617,10 @@ const ButtonGroupComponent = styled.div`
|
|
|
6617
6617
|
justify-content: ${({ $align }) => getAlignment($align)};
|
|
6618
6618
|
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
6619
6619
|
|
|
6620
|
+
${StyledButton$2} {
|
|
6621
|
+
align-self: unset;
|
|
6622
|
+
}
|
|
6623
|
+
|
|
6620
6624
|
${mq.smAndUp} {
|
|
6621
6625
|
flex-direction: row;
|
|
6622
6626
|
}
|
|
@@ -8717,46 +8721,23 @@ const inputCss = css`
|
|
|
8717
8721
|
--wui-input-line-height: 16px;
|
|
8718
8722
|
--wui-input-font-weight: var(--wui-typography-weight-body);
|
|
8719
8723
|
`;
|
|
8720
|
-
/**
|
|
8721
|
-
* Applies the shared visual styling for input-like form controls (background,
|
|
8722
|
-
* outline, focus/error/disabled states, typography). Consumes the tokens from
|
|
8723
|
-
* `inputCss`, which must be applied to the element itself or an ancestor.
|
|
8724
|
-
*/
|
|
8725
|
-
const inputShellCss = css`
|
|
8726
|
-
padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
|
|
8727
|
-
background-color: var(--wui-input-color-bg);
|
|
8728
|
-
border: none;
|
|
8729
|
-
outline: 1px solid var(--wui-input-color-border);
|
|
8730
|
-
outline-offset: -1px;
|
|
8731
|
-
border-radius: var(--wui-input-border-radius);
|
|
8732
|
-
font-size: var(--wui-input-font-size);
|
|
8733
|
-
line-height: var(--wui-input-line-height);
|
|
8734
|
-
font-weight: var(--wui-input-font-weight);
|
|
8735
|
-
color: var(--wui-input-color-text);
|
|
8736
|
-
|
|
8737
|
-
&:focus,
|
|
8738
|
-
&[aria-expanded='true'] {
|
|
8739
|
-
outline-width: 2px;
|
|
8740
|
-
outline-color: var(--wui-input-color-border-focus);
|
|
8741
|
-
outline-offset: -2px;
|
|
8742
|
-
}
|
|
8743
|
-
|
|
8744
|
-
&[aria-invalid='true'] {
|
|
8745
|
-
outline-color: var(--wui-input-color-border-error);
|
|
8746
|
-
}
|
|
8747
|
-
|
|
8748
|
-
&:disabled {
|
|
8749
|
-
outline-color: var(--wui-color-border-disabled);
|
|
8750
|
-
background-color: var(--wui-color-bg-surface-disabled);
|
|
8751
|
-
}
|
|
8752
|
-
`;
|
|
8753
8724
|
//#endregion
|
|
8754
8725
|
//#region src/components/Input/Input.tsx
|
|
8755
8726
|
const inputStyles = css`
|
|
8756
8727
|
${inputCss}
|
|
8757
8728
|
input,
|
|
8758
8729
|
textarea {
|
|
8759
|
-
|
|
8730
|
+
padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
|
|
8731
|
+
background-color: var(--wui-input-color-bg);
|
|
8732
|
+
border: none;
|
|
8733
|
+
outline: 1px solid var(--wui-input-color-border);
|
|
8734
|
+
outline-offset: -1px;
|
|
8735
|
+
border-radius: var(--wui-input-border-radius);
|
|
8736
|
+
font-size: var(--wui-input-font-size);
|
|
8737
|
+
line-height: var(--wui-input-line-height);
|
|
8738
|
+
font-weight: var(--wui-input-font-weight);
|
|
8739
|
+
color: var(--wui-input-color-text);
|
|
8740
|
+
|
|
8760
8741
|
&:read-only {
|
|
8761
8742
|
outline-style: dashed;
|
|
8762
8743
|
}
|
|
@@ -8765,6 +8746,21 @@ const inputStyles = css`
|
|
|
8765
8746
|
color: var(--wui-input-placeholder);
|
|
8766
8747
|
opacity: 1; /* Firefox */
|
|
8767
8748
|
}
|
|
8749
|
+
|
|
8750
|
+
&:focus {
|
|
8751
|
+
outline-width: 2px;
|
|
8752
|
+
outline-color: var(--wui-input-color-border-focus);
|
|
8753
|
+
outline-offset: -2px;
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8756
|
+
&[aria-invalid='true'] {
|
|
8757
|
+
outline-color: var(--wui-input-color-border-error);
|
|
8758
|
+
}
|
|
8759
|
+
|
|
8760
|
+
&:disabled {
|
|
8761
|
+
outline-color: var(--wui-color-border-disabled);
|
|
8762
|
+
background-color: var(--wui-color-bg-surface-disabled);
|
|
8763
|
+
}
|
|
8768
8764
|
}
|
|
8769
8765
|
`;
|
|
8770
8766
|
const calculateTextareaHeight = (rows = 1) => `calc((var(--wui-input-line-height) * ${rows}) + (var(--wui-input-vertical-padding) * 2));`;
|
|
@@ -10397,1422 +10393,449 @@ const DataListItemValue = (props) => {
|
|
|
10397
10393
|
};
|
|
10398
10394
|
DataListItemValue.displayName = "DataListItemValue_UI";
|
|
10399
10395
|
//#endregion
|
|
10400
|
-
//#region src/
|
|
10401
|
-
const
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10396
|
+
//#region src/components/Divider/Divider.tsx
|
|
10397
|
+
const horizontalBorderCss = css`
|
|
10398
|
+
border-top-color: var(--wui-color-border);
|
|
10399
|
+
border-top-style: solid;
|
|
10400
|
+
border-top-width: 1px;
|
|
10401
|
+
clear: both; /* for horizontal dividers, ensure it clears any floats */
|
|
10402
|
+
height: 0;
|
|
10403
|
+
margin-left: var(--wui-divider-inset);
|
|
10404
|
+
margin-right: var(--wui-divider-inset);
|
|
10405
|
+
`;
|
|
10406
|
+
const verticalBorderCss = css`
|
|
10407
|
+
background-color: var(--wui-color-border);
|
|
10408
|
+
max-width: 1px;
|
|
10409
|
+
min-height: 100%;
|
|
10410
|
+
width: 1px;
|
|
10411
|
+
margin-top: var(--wui-divider-inset);
|
|
10412
|
+
margin-bottom: var(--wui-divider-inset);
|
|
10413
|
+
`;
|
|
10414
|
+
const DividerComponent = styled.div`
|
|
10415
|
+
${({ $orientation }) => {
|
|
10416
|
+
switch ($orientation) {
|
|
10417
|
+
case "vertical": return verticalBorderCss;
|
|
10418
|
+
default: return horizontalBorderCss;
|
|
10419
|
+
}
|
|
10420
|
+
}}
|
|
10421
|
+
--wui-divider-inset: ${({ $inset }) => `var(--wui-${$inset})`};
|
|
10422
|
+
|
|
10423
|
+
align-self: stretch;
|
|
10424
|
+
`;
|
|
10425
|
+
/**
|
|
10426
|
+
* A line used to visually separate content; note that dividers have no external margin/spacing on their own.
|
|
10427
|
+
*/
|
|
10428
|
+
const Divider = ({ orientation = "horizontal", inset = "space-00", ...props }) => {
|
|
10429
|
+
const responsiveOrientation = useResponsiveProp(orientation);
|
|
10430
|
+
return /* @__PURE__ */ jsx(DividerComponent, {
|
|
10431
|
+
$inset: useResponsiveProp(inset),
|
|
10432
|
+
$orientation: responsiveOrientation,
|
|
10433
|
+
"aria-orientation": responsiveOrientation,
|
|
10434
|
+
role: "separator",
|
|
10435
|
+
...props
|
|
10436
|
+
});
|
|
10406
10437
|
};
|
|
10438
|
+
Divider.displayName = "Divider_UI";
|
|
10407
10439
|
//#endregion
|
|
10408
|
-
//#region src/components/
|
|
10409
|
-
const
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
/* override inline positioning and rotate the arrow so the circle sits near the trigger and the stalk extends down toward the popup. */
|
|
10413
|
-
&[data-side='top'] {
|
|
10414
|
-
top: 100% !important;
|
|
10440
|
+
//#region src/components/EditableHeading/EditableHeading.tsx
|
|
10441
|
+
const StyledInput$1 = styled(Input)`
|
|
10442
|
+
&:not([rows]) {
|
|
10443
|
+
min-height: unset;
|
|
10415
10444
|
}
|
|
10416
10445
|
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
transform: rotate(180deg);
|
|
10420
|
-
transform-origin: center 0;
|
|
10446
|
+
&:focus {
|
|
10447
|
+
height: ${({ $height }) => `${$height}px !important`};
|
|
10421
10448
|
}
|
|
10422
10449
|
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10450
|
+
&& {
|
|
10451
|
+
${({ $variant }) => variantStyleMap$1[$variant]}
|
|
10452
|
+
/* The input font styles (edit mode) needs the same font styles as Heading */
|
|
10453
|
+
--wui-input-font-size: var(--font-size);
|
|
10454
|
+
--wui-input-font-weight: var(--font-weight);
|
|
10455
|
+
--wui-input-line-height: var(--line-height);
|
|
10429
10456
|
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
const StyledPath = styled.path`
|
|
10438
|
-
fill: var(--wui-color-border-secondary);
|
|
10439
|
-
`;
|
|
10440
|
-
const circleAnimation = keyframes`
|
|
10441
|
-
0% {
|
|
10442
|
-
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
10443
|
-
}
|
|
10444
|
-
100% {
|
|
10445
|
-
opacity: 0;
|
|
10457
|
+
font-family: var(--font-family);
|
|
10458
|
+
width: 100%;
|
|
10459
|
+
padding: var(--wui-space-02);
|
|
10460
|
+
border: none;
|
|
10461
|
+
height: ${({ $height }) => `${$height}px`};
|
|
10462
|
+
min-height: ${({ $height }) => `${$height}px`};
|
|
10463
|
+
resize: none;
|
|
10446
10464
|
}
|
|
10447
10465
|
`;
|
|
10448
|
-
const
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
animation-iteration-count: infinite;
|
|
10452
|
-
animation-direction: alternate;
|
|
10453
|
-
animation-timing-function: ease-in-out;
|
|
10454
|
-
|
|
10455
|
-
&[data-wui-popover-arrow-inner-circle] {
|
|
10456
|
-
--wui-popover-arrow-circle-starting-opacity: 0.36;
|
|
10457
|
-
|
|
10458
|
-
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
10459
|
-
}
|
|
10460
|
-
|
|
10461
|
-
&[data-wui-popover-arrow-outer-circle] {
|
|
10462
|
-
--wui-popover-arrow-circle-starting-opacity: 0.2;
|
|
10463
|
-
|
|
10464
|
-
animation-direction: alternate-reverse;
|
|
10465
|
-
opacity: 0.11;
|
|
10466
|
+
const editableStyles = css`
|
|
10467
|
+
&:has(+ :focus-within) {
|
|
10468
|
+
background: var(--wui-color-bg-surface-hover);
|
|
10466
10469
|
}
|
|
10467
10470
|
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
`}
|
|
10471
|
+
&:hover {
|
|
10472
|
+
background: var(--wui-color-bg-surface-hover);
|
|
10473
|
+
cursor: pointer;
|
|
10472
10474
|
}
|
|
10473
10475
|
`;
|
|
10474
|
-
const
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
children: [
|
|
10482
|
-
/* @__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" }),
|
|
10483
|
-
/* @__PURE__ */ jsx(StyledCircle, {
|
|
10484
|
-
$isAnimated: isAnimated,
|
|
10485
|
-
cx: "24",
|
|
10486
|
-
cy: "32",
|
|
10487
|
-
"data-wui-popover-arrow-inner-circle": true,
|
|
10488
|
-
r: "10",
|
|
10489
|
-
strokeWidth: "4"
|
|
10490
|
-
}),
|
|
10491
|
-
/* @__PURE__ */ jsx(StyledCircle, {
|
|
10492
|
-
$isAnimated: isAnimated,
|
|
10493
|
-
cx: "24",
|
|
10494
|
-
cy: "32",
|
|
10495
|
-
"data-wui-popover-arrow-outer-circle": true,
|
|
10496
|
-
r: "20",
|
|
10497
|
-
strokeWidth: "8"
|
|
10498
|
-
})
|
|
10499
|
-
]
|
|
10500
|
-
}) });
|
|
10501
|
-
};
|
|
10502
|
-
PopoverArrow.displayName = "PopoverArrow_UI";
|
|
10503
|
-
//#endregion
|
|
10504
|
-
//#region src/components/Popover/Popover.tsx
|
|
10505
|
-
const StyledPopup$3 = styled(Popover$1.Popup)`
|
|
10506
|
-
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
10507
|
-
${({ $unstyled }) => !$unstyled && css`
|
|
10508
|
-
border-radius: var(--wui-border-radius-02);
|
|
10509
|
-
padding: var(--wui-space-04);
|
|
10510
|
-
max-width: var(--wui-popover-max-width, 320px);
|
|
10511
|
-
max-height: var(--wui-popover-max-height, auto);
|
|
10512
|
-
background-color: var(--wui-color-bg-surface);
|
|
10513
|
-
box-shadow: var(--wui-elevation-01);
|
|
10514
|
-
border: 1px solid var(--wui-color-border);
|
|
10515
|
-
overflow: auto;
|
|
10516
|
-
`}
|
|
10517
|
-
|
|
10518
|
-
${({ $withArrow }) => $withArrow && css`
|
|
10519
|
-
overflow: visible;
|
|
10520
|
-
`}
|
|
10521
|
-
|
|
10522
|
-
[data-wui-popover-close] {
|
|
10523
|
-
position: absolute;
|
|
10524
|
-
top: var(--wui-space-02);
|
|
10525
|
-
right: var(--wui-space-02);
|
|
10526
|
-
}
|
|
10476
|
+
const StyledHeading = styled(Heading)`
|
|
10477
|
+
width: 100%;
|
|
10478
|
+
border-radius: var(--wui-border-radius-02);
|
|
10479
|
+
padding: var(--wui-space-02);
|
|
10480
|
+
overflow-wrap: anywhere;
|
|
10481
|
+
transition: all var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
10482
|
+
${({ $editingDisabled }) => !$editingDisabled && editableStyles}
|
|
10527
10483
|
`;
|
|
10528
10484
|
/**
|
|
10529
|
-
*
|
|
10530
|
-
*
|
|
10531
|
-
*
|
|
10532
|
-
*
|
|
10533
|
-
* `PopoverPortal`, `PopoverContent`, `PopoverClose`.
|
|
10485
|
+
* A special heading component that allows for inline editing. When clicked or activated via keyboard,
|
|
10486
|
+
* it transforms into an editable text field. In its default state, it renders as a heading with
|
|
10487
|
+
* an accessible button that enables editing mode. The component handles empty values, keyboard
|
|
10488
|
+
* navigation (Enter to save, Escape to cancel), and provides callbacks for value and state changes.
|
|
10534
10489
|
*/
|
|
10535
|
-
const
|
|
10536
|
-
const
|
|
10537
|
-
const
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
}), /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
10548
|
-
align,
|
|
10549
|
-
collisionAvoidance: {
|
|
10550
|
-
side: "flip",
|
|
10551
|
-
align: "shift",
|
|
10552
|
-
fallbackAxisSide: "none"
|
|
10553
|
-
},
|
|
10554
|
-
side,
|
|
10555
|
-
sideOffset,
|
|
10556
|
-
style: { zIndex: "var(--wui-zindex-popover)" },
|
|
10557
|
-
children: /* @__PURE__ */ jsxs(StyledPopup$3, {
|
|
10558
|
-
$colorScheme: colorScheme,
|
|
10559
|
-
...props,
|
|
10560
|
-
$unstyled: unstyled,
|
|
10561
|
-
$withArrow: withArrow,
|
|
10562
|
-
role: "dialog",
|
|
10563
|
-
style: mergedStyle,
|
|
10564
|
-
children: [
|
|
10565
|
-
!hideCloseButton && /* @__PURE__ */ jsx(Popover$1.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
10566
|
-
"data-wui-popover-close": true,
|
|
10567
|
-
label: "Close",
|
|
10568
|
-
variant: "ghost",
|
|
10569
|
-
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
10570
|
-
}) }),
|
|
10571
|
-
withArrow ? /* @__PURE__ */ jsx(PopoverArrow, { isAnimated }) : null,
|
|
10572
|
-
/* @__PURE__ */ jsx("div", { children })
|
|
10573
|
-
]
|
|
10574
|
-
})
|
|
10575
|
-
}) })]
|
|
10576
|
-
});
|
|
10577
|
-
};
|
|
10578
|
-
Popover.displayName = "Popover_UI";
|
|
10579
|
-
//#endregion
|
|
10580
|
-
//#region src/components/Popover/PopoverAnchorContext.tsx
|
|
10581
|
-
const PopoverAnchorContext = createContext(null);
|
|
10582
|
-
const PopoverAnchorProvider = PopoverAnchorContext;
|
|
10583
|
-
const usePopoverAnchor = () => useContext(PopoverAnchorContext);
|
|
10584
|
-
const useCreatePopoverAnchorRef = () => useRef(null);
|
|
10585
|
-
//#endregion
|
|
10586
|
-
//#region src/components/Popover/PopoverAnchor.tsx
|
|
10587
|
-
/**
|
|
10588
|
-
* Positions the popover relative to an element other than the trigger. Useful
|
|
10589
|
-
* when the element the user interacts with (e.g. a text input) is separate
|
|
10590
|
-
* from what the popover attaches to.
|
|
10591
|
-
*
|
|
10592
|
-
* Wrap the anchor element and nest `PopoverTrigger` inside it.
|
|
10593
|
-
*/
|
|
10594
|
-
const PopoverAnchor = ({ children }) => {
|
|
10595
|
-
const sharedRef = usePopoverAnchor();
|
|
10596
|
-
return /* @__PURE__ */ jsx("div", {
|
|
10597
|
-
ref: useCallback((node) => {
|
|
10598
|
-
if (sharedRef) sharedRef.current = node;
|
|
10599
|
-
}, [sharedRef]),
|
|
10600
|
-
children
|
|
10601
|
-
});
|
|
10602
|
-
};
|
|
10603
|
-
PopoverAnchor.displayName = "PopoverAnchor_UI";
|
|
10604
|
-
//#endregion
|
|
10605
|
-
//#region src/components/Popover/PopoverClose.tsx
|
|
10606
|
-
/**
|
|
10607
|
-
* An element that closes the popover when activated. Defaults to a `<button>`;
|
|
10608
|
-
* pass `render` to merge the close behavior onto a single child element. For
|
|
10609
|
-
* a pre-styled icon close button, use `PopoverCloseButton`.
|
|
10610
|
-
*/
|
|
10611
|
-
const PopoverClose = ({ ref, ...props }) => /* @__PURE__ */ jsx(Popover$1.Close, {
|
|
10612
|
-
ref,
|
|
10613
|
-
...props
|
|
10614
|
-
});
|
|
10615
|
-
//#endregion
|
|
10616
|
-
//#region src/components/Popover/PopoverCloseButton.tsx
|
|
10617
|
-
/**
|
|
10618
|
-
* A pre-styled close button intended to be placed inside a `PopoverContent`.
|
|
10619
|
-
* For a custom close control, use `PopoverClose` directly.
|
|
10620
|
-
*/
|
|
10621
|
-
const PopoverCloseButton = ({ label = "Close" }) => /* @__PURE__ */ jsx(PopoverClose, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
10622
|
-
"data-wui-popover-close": true,
|
|
10623
|
-
label,
|
|
10624
|
-
variant: "ghost",
|
|
10625
|
-
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
10626
|
-
}) });
|
|
10627
|
-
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
10628
|
-
//#endregion
|
|
10629
|
-
//#region src/components/Popover/PopoverContent.tsx
|
|
10630
|
-
const StyledPopup$2 = styled(Popover$1.Popup)`
|
|
10631
|
-
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
10632
|
-
${({ $unstyled }) => !$unstyled && css`
|
|
10633
|
-
border-radius: var(--wui-border-radius-02);
|
|
10634
|
-
padding: var(--wui-space-04);
|
|
10635
|
-
max-width: var(--wui-popover-max-width);
|
|
10636
|
-
max-height: var(--wui-popover-max-height);
|
|
10637
|
-
background-color: var(--wui-color-bg-surface);
|
|
10638
|
-
box-shadow: var(--wui-elevation-01);
|
|
10639
|
-
border: 1px solid var(--wui-color-border);
|
|
10640
|
-
overflow: auto;
|
|
10641
|
-
`}
|
|
10642
|
-
|
|
10643
|
-
[data-wui-popover-close] {
|
|
10644
|
-
position: absolute;
|
|
10645
|
-
top: var(--wui-space-02);
|
|
10646
|
-
right: var(--wui-space-02);
|
|
10647
|
-
}
|
|
10648
|
-
`;
|
|
10649
|
-
const DEFAULT_SIDE_OFFSET = 8;
|
|
10650
|
-
const DEFAULT_MAX_WIDTH = "320px";
|
|
10651
|
-
const DEFAULT_MAX_HEIGHT = "auto";
|
|
10652
|
-
/**
|
|
10653
|
-
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
10654
|
-
* in a `PopoverPortal`). Wraps a `Positioner` and `Popup` internally.
|
|
10655
|
-
*/
|
|
10656
|
-
const PopoverContent = ({ colorScheme = "inherit", unstyled = false, maxWidth = DEFAULT_MAX_WIDTH, maxHeight = DEFAULT_MAX_HEIGHT, sideOffset = DEFAULT_SIDE_OFFSET, side, align, style, role = "dialog", children, ref, ...props }) => {
|
|
10657
|
-
const sharedAnchorRef = usePopoverAnchor();
|
|
10658
|
-
const hasAnchor = sharedAnchorRef?.current != null;
|
|
10659
|
-
const mergedStyle = {
|
|
10660
|
-
"--wui-popover-max-width": maxWidth,
|
|
10661
|
-
"--wui-popover-max-height": maxHeight,
|
|
10662
|
-
...style
|
|
10663
|
-
};
|
|
10664
|
-
return /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
10665
|
-
align,
|
|
10666
|
-
collisionAvoidance: {
|
|
10667
|
-
side: "flip",
|
|
10668
|
-
align: "shift",
|
|
10669
|
-
fallbackAxisSide: "none"
|
|
10670
|
-
},
|
|
10671
|
-
side,
|
|
10672
|
-
sideOffset,
|
|
10673
|
-
style: { zIndex: "var(--wui-zindex-popover)" },
|
|
10674
|
-
...hasAnchor ? { anchor: sharedAnchorRef } : {},
|
|
10675
|
-
children: /* @__PURE__ */ jsx(StyledPopup$2, {
|
|
10676
|
-
ref,
|
|
10677
|
-
$colorScheme: colorScheme,
|
|
10678
|
-
$unstyled: unstyled,
|
|
10679
|
-
role,
|
|
10680
|
-
style: mergedStyle,
|
|
10681
|
-
...props,
|
|
10682
|
-
children
|
|
10683
|
-
})
|
|
10684
|
-
});
|
|
10685
|
-
};
|
|
10686
|
-
//#endregion
|
|
10687
|
-
//#region src/components/Popover/PopoverPortal.tsx
|
|
10688
|
-
/**
|
|
10689
|
-
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
10690
|
-
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
10691
|
-
*/
|
|
10692
|
-
const PopoverPortal = ({ children }) => /* @__PURE__ */ jsx(Popover$1.Portal, { children });
|
|
10693
|
-
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
10694
|
-
//#endregion
|
|
10695
|
-
//#region src/components/Popover/PopoverRoot.tsx
|
|
10696
|
-
/**
|
|
10697
|
-
* The root of a composable popover. Wrap `PopoverTrigger` (or `PopoverAnchor`)
|
|
10698
|
-
* and `PopoverContent` inside it.
|
|
10699
|
-
*
|
|
10700
|
-
* For the common "button opens a panel" case, prefer the bundled `Popover`.
|
|
10701
|
-
*/
|
|
10702
|
-
const PopoverRoot = ({ isOpen, onOpenChange, children }) => {
|
|
10703
|
-
const anchorRef = useCreatePopoverAnchorRef();
|
|
10704
|
-
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
10705
|
-
...getControlProps(isOpen, onOpenChange),
|
|
10706
|
-
children: /* @__PURE__ */ jsx(PopoverAnchorProvider, {
|
|
10707
|
-
value: anchorRef,
|
|
10708
|
-
children
|
|
10709
|
-
})
|
|
10710
|
-
});
|
|
10711
|
-
};
|
|
10712
|
-
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
10713
|
-
//#endregion
|
|
10714
|
-
//#region src/components/Popover/PopoverTrigger.tsx
|
|
10715
|
-
/**
|
|
10716
|
-
* The button that toggles the popover open and closed. By default it renders a
|
|
10717
|
-
* `<button>` wrapping its children; pass `render` to merge the trigger
|
|
10718
|
-
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
10719
|
-
*/
|
|
10720
|
-
const PopoverTrigger = ({ nativeButton = true, ref, ...props }) => /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
10721
|
-
ref,
|
|
10722
|
-
nativeButton,
|
|
10723
|
-
...props
|
|
10724
|
-
});
|
|
10725
|
-
//#endregion
|
|
10726
|
-
//#region src/components/DatePicker/DatePickerContext.tsx
|
|
10727
|
-
const DatePickerContext = createContext(null);
|
|
10728
|
-
const DatePickerProvider = DatePickerContext.Provider;
|
|
10729
|
-
const useDatePickerContext = () => {
|
|
10730
|
-
const context = useContext(DatePickerContext);
|
|
10731
|
-
if (context === null) throw new Error("useDatePickerContext must be used within a DatePickerProvider");
|
|
10732
|
-
return context;
|
|
10733
|
-
};
|
|
10734
|
-
//#endregion
|
|
10735
|
-
//#region src/components/DatePicker/datePickerUtils.ts
|
|
10736
|
-
/**
|
|
10737
|
-
* Formats a Date into a human-readable string (e.g. "Jun 3, 2021").
|
|
10738
|
-
* Returns an empty string for null/undefined.
|
|
10739
|
-
*/
|
|
10740
|
-
const formatDate = (date) => {
|
|
10741
|
-
if (date === null) return "";
|
|
10742
|
-
return dateOnlyString(date);
|
|
10743
|
-
};
|
|
10744
|
-
/**
|
|
10745
|
-
* Formats a Date as an ISO 8601 date-only string (`YYYY-MM-DD`) in local time.
|
|
10746
|
-
* Intended for form submission — unlike the locale-formatted display string,
|
|
10747
|
-
* this is stable across locales and trivial for backends to parse.
|
|
10748
|
-
*/
|
|
10749
|
-
const toISODate = (date) => {
|
|
10750
|
-
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
10751
|
-
};
|
|
10752
|
-
const stripTime = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
10753
|
-
/**
|
|
10754
|
-
* Returns true if the date falls within the min/max range (inclusive).
|
|
10755
|
-
*/
|
|
10756
|
-
const isDateInRange = (date, minDate, maxDate) => {
|
|
10757
|
-
const dateOnly = stripTime(date);
|
|
10758
|
-
if (minDate !== void 0 && dateOnly < stripTime(minDate)) return false;
|
|
10759
|
-
if (maxDate !== void 0 && dateOnly > stripTime(maxDate)) return false;
|
|
10760
|
-
return true;
|
|
10761
|
-
};
|
|
10762
|
-
/**
|
|
10763
|
-
* Returns true if the date matches any of the disabled matchers.
|
|
10764
|
-
* Supports a subset of react-day-picker Matcher types:
|
|
10765
|
-
* - Date objects (exact match by day)
|
|
10766
|
-
* - { dayOfWeek: number[] }
|
|
10767
|
-
* - { before: Date } / { after: Date }
|
|
10768
|
-
* - { from: Date, to: Date }
|
|
10769
|
-
*/
|
|
10770
|
-
const isDateDisabled = (date, disabledDates) => {
|
|
10771
|
-
if (disabledDates === void 0) return false;
|
|
10772
|
-
const matchers = Array.isArray(disabledDates) ? disabledDates : [disabledDates];
|
|
10773
|
-
const dateOnly = stripTime(date);
|
|
10774
|
-
return matchers.some((matcher) => {
|
|
10775
|
-
if (matcher instanceof Date) return dateOnly.getTime() === stripTime(matcher).getTime();
|
|
10776
|
-
if (typeof matcher !== "object") return false;
|
|
10777
|
-
if ("dayOfWeek" in matcher && Array.isArray(matcher.dayOfWeek)) return matcher.dayOfWeek.includes(date.getDay());
|
|
10778
|
-
if ("before" in matcher && matcher.before instanceof Date) return dateOnly < stripTime(matcher.before);
|
|
10779
|
-
if ("after" in matcher && matcher.after instanceof Date) return dateOnly > stripTime(matcher.after);
|
|
10780
|
-
if ("from" in matcher && "to" in matcher) {
|
|
10781
|
-
const { from } = matcher;
|
|
10782
|
-
const { to } = matcher;
|
|
10783
|
-
if (from instanceof Date && to instanceof Date) return dateOnly >= stripTime(from) && dateOnly <= stripTime(to);
|
|
10784
|
-
}
|
|
10785
|
-
return false;
|
|
10786
|
-
});
|
|
10787
|
-
};
|
|
10788
|
-
/**
|
|
10789
|
-
* Builds a combined disabled matcher array for react-day-picker from
|
|
10790
|
-
* minDate, maxDate, and user-provided disabledDates.
|
|
10791
|
-
*/
|
|
10792
|
-
const buildDisabledMatcher = (minDate, maxDate, disabledDates) => {
|
|
10793
|
-
const matchers = [];
|
|
10794
|
-
if (minDate !== void 0) matchers.push({ before: minDate });
|
|
10795
|
-
if (maxDate !== void 0) matchers.push({ after: maxDate });
|
|
10796
|
-
if (disabledDates !== void 0) if (Array.isArray(disabledDates)) matchers.push(...disabledDates);
|
|
10797
|
-
else matchers.push(disabledDates);
|
|
10798
|
-
return matchers;
|
|
10799
|
-
};
|
|
10800
|
-
//#endregion
|
|
10801
|
-
//#region src/components/DatePicker/DatePickerInput.tsx
|
|
10802
|
-
const StyledMobileTrigger = styled.button`
|
|
10803
|
-
${inputCss}
|
|
10804
|
-
${inputShellCss}
|
|
10805
|
-
|
|
10806
|
-
display: inline-flex;
|
|
10807
|
-
align-items: center;
|
|
10808
|
-
justify-content: space-between;
|
|
10809
|
-
gap: var(--wui-space-02);
|
|
10810
|
-
width: 100%;
|
|
10811
|
-
font-family: inherit;
|
|
10812
|
-
text-align: left;
|
|
10813
|
-
cursor: pointer;
|
|
10814
|
-
|
|
10815
|
-
&:disabled {
|
|
10816
|
-
cursor: not-allowed;
|
|
10817
|
-
}
|
|
10818
|
-
|
|
10819
|
-
&[data-empty='true'] {
|
|
10820
|
-
color: var(--wui-input-placeholder);
|
|
10821
|
-
}
|
|
10822
|
-
`;
|
|
10823
|
-
const DatePickerInput = ({ placeholder = "Select a date...", fullWidth, name, id, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => {
|
|
10824
|
-
const { selectedDate, isOpen, inputText, disabled, isMobile, popoverId, inputRef, popoverContentRef, handleInputChange, handleCommit, handleCancel, openPopover } = useDatePickerContext();
|
|
10825
|
-
const submittedValue = selectedDate !== null ? toISODate(selectedDate) : "";
|
|
10826
|
-
const handleClick = () => {
|
|
10827
|
-
if (!isOpen) openPopover();
|
|
10828
|
-
};
|
|
10829
|
-
if (isMobile) {
|
|
10830
|
-
const handleMobileKeyDown = (event) => {
|
|
10831
|
-
if (event.key === "Escape" && isOpen) {
|
|
10832
|
-
event.preventDefault();
|
|
10833
|
-
handleCancel();
|
|
10834
|
-
}
|
|
10835
|
-
};
|
|
10836
|
-
const isEmpty = inputText.length === 0;
|
|
10837
|
-
return /* @__PURE__ */ jsxs(PopoverAnchor, { children: [/* @__PURE__ */ jsxs(StyledMobileTrigger, {
|
|
10838
|
-
ref: inputRef,
|
|
10839
|
-
"aria-controls": isOpen ? popoverId : void 0,
|
|
10840
|
-
"aria-describedby": ariaDescribedBy,
|
|
10841
|
-
"aria-expanded": isOpen,
|
|
10842
|
-
"aria-haspopup": "dialog",
|
|
10843
|
-
...ariaInvalid !== void 0 ? { "aria-invalid": ariaInvalid } : {},
|
|
10844
|
-
$fullWidth: fullWidth ?? false,
|
|
10845
|
-
"data-empty": isEmpty,
|
|
10846
|
-
disabled,
|
|
10847
|
-
id,
|
|
10848
|
-
type: "button",
|
|
10849
|
-
onClick: handleClick,
|
|
10850
|
-
onKeyDown: handleMobileKeyDown,
|
|
10851
|
-
children: [/* @__PURE__ */ jsx("span", { children: isEmpty ? placeholder : inputText }), /* @__PURE__ */ jsx(Icon, {
|
|
10852
|
-
type: "calendar",
|
|
10853
|
-
size: "md"
|
|
10854
|
-
})]
|
|
10855
|
-
}), name !== void 0 && /* @__PURE__ */ jsx("input", {
|
|
10856
|
-
name,
|
|
10857
|
-
type: "hidden",
|
|
10858
|
-
value: submittedValue
|
|
10859
|
-
})] });
|
|
10860
|
-
}
|
|
10861
|
-
const handleBlur = (event) => {
|
|
10862
|
-
const relatedTarget = event.relatedTarget;
|
|
10863
|
-
if (relatedTarget !== null && popoverContentRef.current?.contains(relatedTarget)) return;
|
|
10864
|
-
handleCommit();
|
|
10490
|
+
const EditableHeading = ({ children, onValueChange, onEditingChange, tooltipText = "Click to edit title", ariaLabel = "Edit title", variant = "heading1", __forceEditing = false, editingDisabled = false }) => {
|
|
10491
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
10492
|
+
const [value, setValue] = useState(children);
|
|
10493
|
+
const [previousValue, setPreviousValue] = useState(children);
|
|
10494
|
+
const [headingHeight, setHeadingHeight] = useState("60");
|
|
10495
|
+
const headingRef = useRef(null);
|
|
10496
|
+
const handleSetEditing = (editing) => {
|
|
10497
|
+
if (editingDisabled) return;
|
|
10498
|
+
if (editing && headingRef.current) setHeadingHeight(`${headingRef.current.offsetHeight}`);
|
|
10499
|
+
if (editing) setPreviousValue(value);
|
|
10500
|
+
setIsEditing(editing);
|
|
10501
|
+
onEditingChange?.(editing);
|
|
10865
10502
|
};
|
|
10866
|
-
const
|
|
10867
|
-
const
|
|
10868
|
-
if (
|
|
10869
|
-
|
|
10503
|
+
const handleFinishEditing = () => {
|
|
10504
|
+
const trimmedValue = value.trim();
|
|
10505
|
+
if (trimmedValue === "") setValue(previousValue);
|
|
10506
|
+
else if (trimmedValue !== previousValue && onValueChange) onValueChange(trimmedValue);
|
|
10507
|
+
else setValue(trimmedValue);
|
|
10508
|
+
handleSetEditing(false);
|
|
10870
10509
|
};
|
|
10871
10510
|
const handleKeyDown = (event) => {
|
|
10872
|
-
if (event.key === "Enter") {
|
|
10873
|
-
event.preventDefault();
|
|
10874
|
-
handleCommit();
|
|
10875
|
-
return;
|
|
10876
|
-
}
|
|
10877
|
-
if (event.key === "Escape" && isOpen) {
|
|
10511
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
10878
10512
|
event.preventDefault();
|
|
10879
|
-
|
|
10880
|
-
return;
|
|
10513
|
+
handleFinishEditing();
|
|
10881
10514
|
}
|
|
10882
|
-
if (event.key === "
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
if (!event.altKey) requestAnimationFrame(() => {
|
|
10886
|
-
focusGrid();
|
|
10887
|
-
});
|
|
10515
|
+
if (event.key === "Escape") {
|
|
10516
|
+
setValue(previousValue);
|
|
10517
|
+
handleSetEditing(false);
|
|
10888
10518
|
}
|
|
10889
10519
|
};
|
|
10890
|
-
|
|
10891
|
-
ref:
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10520
|
+
const HeadingComponent = /* @__PURE__ */ jsx(StyledHeading, {
|
|
10521
|
+
ref: headingRef,
|
|
10522
|
+
$editingDisabled: editingDisabled,
|
|
10523
|
+
onClick: () => handleSetEditing(true),
|
|
10524
|
+
variant,
|
|
10525
|
+
children: value
|
|
10526
|
+
});
|
|
10527
|
+
if (editingDisabled) return HeadingComponent;
|
|
10528
|
+
if (isEditing || __forceEditing) return /* @__PURE__ */ jsx(StyledInput$1, {
|
|
10529
|
+
$height: headingHeight,
|
|
10530
|
+
$variant: variant,
|
|
10531
|
+
autoFocus: true,
|
|
10532
|
+
fullWidth: true,
|
|
10533
|
+
onBlur: handleFinishEditing,
|
|
10534
|
+
onChange: (event) => setValue(event.target.value),
|
|
10535
|
+
onFocus: (event) => {
|
|
10536
|
+
const { length } = event.currentTarget.value;
|
|
10537
|
+
event.currentTarget.setSelectionRange(length, length);
|
|
10907
10538
|
},
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10539
|
+
onKeyDown: handleKeyDown,
|
|
10540
|
+
type: "multiline",
|
|
10541
|
+
value
|
|
10542
|
+
});
|
|
10543
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
10544
|
+
content: tooltipText,
|
|
10545
|
+
children: HeadingComponent
|
|
10546
|
+
}), /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx("button", {
|
|
10547
|
+
"aria-label": ariaLabel,
|
|
10548
|
+
onClick: () => handleSetEditing(true),
|
|
10549
|
+
type: "button"
|
|
10550
|
+
}) })] });
|
|
10915
10551
|
};
|
|
10916
|
-
DatePickerInput.displayName = "DatePickerInput_UI";
|
|
10917
10552
|
//#endregion
|
|
10918
|
-
//#region src/
|
|
10919
|
-
const
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10553
|
+
//#region src/components/EditableText/EditableTextRoot.tsx
|
|
10554
|
+
const LARGE_PADDING = "var(--wui-space-02)";
|
|
10555
|
+
const SMALL_PADDING = "var(--wui-space-01)";
|
|
10556
|
+
const getPaddingForVariant = (variant) => {
|
|
10557
|
+
const largePaddingVariants = [
|
|
10558
|
+
"hero",
|
|
10559
|
+
"heading1",
|
|
10560
|
+
"heading2",
|
|
10561
|
+
"heading3",
|
|
10562
|
+
"body1",
|
|
10563
|
+
"label1",
|
|
10564
|
+
"body1Mono"
|
|
10565
|
+
];
|
|
10566
|
+
const smallPaddingVariants = [
|
|
10567
|
+
"heading4",
|
|
10568
|
+
"heading5",
|
|
10569
|
+
"heading6",
|
|
10570
|
+
"body2",
|
|
10571
|
+
"body3",
|
|
10572
|
+
"body4",
|
|
10573
|
+
"label2",
|
|
10574
|
+
"label3",
|
|
10575
|
+
"label4",
|
|
10576
|
+
"body2Mono",
|
|
10577
|
+
"body3Mono",
|
|
10578
|
+
"body4Mono"
|
|
10579
|
+
];
|
|
10580
|
+
if (largePaddingVariants.includes(variant)) return LARGE_PADDING;
|
|
10581
|
+
if (smallPaddingVariants.includes(variant)) return SMALL_PADDING;
|
|
10582
|
+
return SMALL_PADDING;
|
|
10583
|
+
};
|
|
10584
|
+
const StyledEditableTextRoot = styled.div`
|
|
10585
|
+
display: contents;
|
|
10586
|
+
|
|
10587
|
+
--wui-editable-text-padding: ${({ $typographicVariant }) => getPaddingForVariant($typographicVariant)};
|
|
10588
|
+
--wui-editable-text-border-radius: var(--wui-border-radius-01);
|
|
10925
10589
|
`;
|
|
10926
|
-
const
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10590
|
+
const EditableTextContext = createContext(null);
|
|
10591
|
+
const EditableTextRoot = ({ children, defaultValue = "", value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant = "body2", submitMode = "both", readOnly = false, id, label, placeholder = "Click to edit this text", minLines = 1, maxLines, finalFocusEl, ...props }) => {
|
|
10592
|
+
const isControlled = controlledValue !== void 0;
|
|
10593
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
10594
|
+
const [originalValue, setOriginalValue] = useState(defaultValue);
|
|
10595
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
10596
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
10597
|
+
const generatedId = useId();
|
|
10598
|
+
const computedId = isNonEmptyString(id) ? id : `wistia-ui-editable-text-${generatedId}`;
|
|
10599
|
+
const handleSetIsEditing = useCallback((editing) => {
|
|
10600
|
+
if (editing && !isEditing) setOriginalValue(value);
|
|
10601
|
+
setIsEditing(editing);
|
|
10602
|
+
onEditingChange?.(editing);
|
|
10603
|
+
}, [
|
|
10604
|
+
isEditing,
|
|
10605
|
+
value,
|
|
10606
|
+
onEditingChange
|
|
10607
|
+
]);
|
|
10608
|
+
const setValue = useCallback((newValue) => {
|
|
10609
|
+
if (!isControlled) setInternalValue(newValue);
|
|
10610
|
+
onValueChange?.(newValue);
|
|
10611
|
+
}, [isControlled, onValueChange]);
|
|
10612
|
+
const context = useMemo(() => {
|
|
10613
|
+
return {
|
|
10614
|
+
isEditing,
|
|
10615
|
+
setIsEditing: handleSetIsEditing,
|
|
10616
|
+
value,
|
|
10617
|
+
setValue,
|
|
10618
|
+
originalValue,
|
|
10619
|
+
onValueCommit,
|
|
10620
|
+
onValueRevert,
|
|
10621
|
+
typographicVariant,
|
|
10622
|
+
submitMode,
|
|
10623
|
+
readOnly,
|
|
10624
|
+
id: computedId,
|
|
10625
|
+
label,
|
|
10626
|
+
placeholder,
|
|
10627
|
+
minLines,
|
|
10628
|
+
maxLines,
|
|
10629
|
+
finalFocusEl
|
|
10630
|
+
};
|
|
10631
|
+
}, [
|
|
10632
|
+
isEditing,
|
|
10633
|
+
handleSetIsEditing,
|
|
10634
|
+
value,
|
|
10635
|
+
setValue,
|
|
10636
|
+
originalValue,
|
|
10637
|
+
onValueCommit,
|
|
10638
|
+
onValueRevert,
|
|
10639
|
+
typographicVariant,
|
|
10640
|
+
submitMode,
|
|
10641
|
+
readOnly,
|
|
10642
|
+
computedId,
|
|
10643
|
+
label,
|
|
10644
|
+
placeholder,
|
|
10645
|
+
minLines,
|
|
10646
|
+
maxLines,
|
|
10647
|
+
finalFocusEl
|
|
10648
|
+
]);
|
|
10649
|
+
const getState = () => {
|
|
10650
|
+
if (readOnly) return "read-only";
|
|
10651
|
+
if (isEditing) return "editing";
|
|
10652
|
+
return "idle";
|
|
10653
|
+
};
|
|
10654
|
+
return /* @__PURE__ */ jsx(StyledEditableTextRoot, {
|
|
10655
|
+
$typographicVariant: typographicVariant,
|
|
10656
|
+
"data-testid": "editable-text-root",
|
|
10657
|
+
"data-wui-editable-text-root": true,
|
|
10658
|
+
"data-wui-editable-text-state": getState(),
|
|
10659
|
+
...props,
|
|
10660
|
+
children: /* @__PURE__ */ jsx(EditableTextContext, {
|
|
10661
|
+
value: context,
|
|
10662
|
+
children
|
|
10663
|
+
})
|
|
10664
|
+
});
|
|
10942
10665
|
};
|
|
10943
|
-
CalendarNavigation.displayName = "CalendarNavigation";
|
|
10944
10666
|
//#endregion
|
|
10945
|
-
//#region src/
|
|
10946
|
-
const
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
/* Months layout */
|
|
10965
|
-
.rdp-months {
|
|
10966
|
-
display: flex;
|
|
10967
|
-
gap: var(--wui-space-05);
|
|
10968
|
-
}
|
|
10969
|
-
|
|
10970
|
-
.rdp-month {
|
|
10971
|
-
display: flex;
|
|
10972
|
-
flex-direction: column;
|
|
10973
|
-
}
|
|
10974
|
-
|
|
10975
|
-
/* Caption / navigation row */
|
|
10976
|
-
.rdp-month_caption {
|
|
10977
|
-
display: flex;
|
|
10978
|
-
align-items: center;
|
|
10979
|
-
justify-content: space-between;
|
|
10980
|
-
padding-left: var(--wui-space-01);
|
|
10981
|
-
}
|
|
10982
|
-
|
|
10983
|
-
.rdp-caption_label {
|
|
10984
|
-
font-family: var(--wui-typography-heading-4-family);
|
|
10985
|
-
font-weight: var(--wui-typography-heading-4-weight);
|
|
10986
|
-
font-size: var(--wui-typography-heading-4-size);
|
|
10987
|
-
line-height: var(--wui-typography-heading-4-line-height);
|
|
10988
|
-
min-height: 32px;
|
|
10989
|
-
display: flex;
|
|
10990
|
-
align-items: center;
|
|
10991
|
-
white-space: nowrap;
|
|
10992
|
-
}
|
|
10993
|
-
|
|
10994
|
-
/* Grid */
|
|
10995
|
-
.rdp-month_grid {
|
|
10996
|
-
border-collapse: collapse;
|
|
10997
|
-
border-spacing: 0;
|
|
10998
|
-
}
|
|
10667
|
+
//#region src/components/EditableText/EditableTextDisplay.tsx
|
|
10668
|
+
const StyledEditableTextDisplay = styled.div`
|
|
10669
|
+
${({ $typographicVariant }) => getTypographicStyles($typographicVariant)}
|
|
10670
|
+
padding: var(--wui-editable-text-padding);
|
|
10671
|
+
border-radius: var(--wui-editable-text-border-radius);
|
|
10672
|
+
margin: 0;
|
|
10673
|
+
transition: all var(--wui-motion-duration-02) var(--wui-motion-ease);
|
|
10674
|
+
${({ $maxLines }) => {
|
|
10675
|
+
if (isNotNil($maxLines)) return css`
|
|
10676
|
+
${ellipsisStyle};
|
|
10677
|
+
${lineClampCss($maxLines)};
|
|
10678
|
+
`;
|
|
10679
|
+
}}
|
|
10680
|
+
${({ $minLines }) => isNotNil($minLines) && css`
|
|
10681
|
+
min-height: calc(${$minLines}lh + calc(var(--wui-editable-text-padding) * 2));
|
|
10682
|
+
`}
|
|
10683
|
+
word-break: normal;
|
|
10684
|
+
overflow-wrap: anywhere;
|
|
10999
10685
|
|
|
11000
|
-
|
|
11001
|
-
.rdp-weekday {
|
|
10686
|
+
&[data-wui-editable-text-display='placeholder'] {
|
|
11002
10687
|
color: var(--wui-color-text-secondary);
|
|
11003
|
-
font-weight: var(--wui-typography-label-3-weight);
|
|
11004
|
-
font-size: var(--wui-typography-label-3-size);
|
|
11005
|
-
line-height: var(--wui-typography-label-3-line-height);
|
|
11006
|
-
text-align: center;
|
|
11007
|
-
width: var(--rdp-day-size);
|
|
11008
|
-
height: var(--rdp-day-size);
|
|
11009
|
-
padding: 0;
|
|
11010
|
-
}
|
|
11011
|
-
|
|
11012
|
-
/* Day cells */
|
|
11013
|
-
.rdp-day {
|
|
11014
|
-
width: var(--rdp-day-size);
|
|
11015
|
-
height: var(--rdp-day-size);
|
|
11016
|
-
text-align: center;
|
|
11017
|
-
padding: 0;
|
|
11018
10688
|
}
|
|
11019
10689
|
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
--rdp-day-button-size: calc(var(--rdp-day-size) - 4px);
|
|
11023
|
-
|
|
11024
|
-
display: inline-flex;
|
|
11025
|
-
align-items: center;
|
|
11026
|
-
justify-content: center;
|
|
11027
|
-
width: var(--rdp-day-button-size);
|
|
11028
|
-
height: var(--rdp-day-button-size);
|
|
11029
|
-
border: none;
|
|
11030
|
-
border-radius: var(--wui-border-radius-rounded);
|
|
11031
|
-
background: none;
|
|
10690
|
+
&:has(button) {
|
|
10691
|
+
user-select: none;
|
|
11032
10692
|
cursor: pointer;
|
|
11033
|
-
font-family: var(--wui-typography-label-3-family);
|
|
11034
|
-
font-size: var(--wui-typography-label-3-size);
|
|
11035
|
-
font-weight: var(--wui-typography-label-3-weight);
|
|
11036
|
-
line-height: var(--wui-typography-label-3-line-height);
|
|
11037
|
-
color: var(--wui-color-text);
|
|
11038
|
-
padding: 0;
|
|
11039
|
-
transition: background-color var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
11040
10693
|
|
|
11041
|
-
&:hover
|
|
10694
|
+
&:hover,
|
|
10695
|
+
&:focus-within {
|
|
11042
10696
|
background-color: var(--wui-color-bg-surface-hover);
|
|
11043
10697
|
}
|
|
11044
|
-
|
|
11045
|
-
&:focus-visible {
|
|
11046
|
-
outline: 2px solid var(--wui-color-focus-ring);
|
|
11047
|
-
outline-offset: 1px;
|
|
11048
|
-
}
|
|
11049
|
-
}
|
|
11050
|
-
|
|
11051
|
-
/* Day button — today */
|
|
11052
|
-
.rdp-today .rdp-day_button {
|
|
11053
|
-
color: var(--wui-color-text-button-blue);
|
|
11054
|
-
font-weight: var(--wui-typography-weight-label-bold);
|
|
11055
|
-
}
|
|
11056
|
-
|
|
11057
|
-
/* Day button — outside month */
|
|
11058
|
-
.rdp-outside .rdp-day_button {
|
|
11059
|
-
color: var(--wui-color-text-secondary);
|
|
11060
|
-
}
|
|
11061
|
-
|
|
11062
|
-
/* Day button — selected */
|
|
11063
|
-
.rdp-selected .rdp-day_button {
|
|
11064
|
-
background-color: var(--wui-color-bg-fill);
|
|
11065
|
-
color: var(--wui-color-text-on-fill);
|
|
11066
|
-
|
|
11067
|
-
&:hover:not([disabled]) {
|
|
11068
|
-
background-color: var(--wui-color-bg-fill-hover);
|
|
11069
|
-
}
|
|
11070
|
-
}
|
|
11071
|
-
|
|
11072
|
-
/* Day button — disabled */
|
|
11073
|
-
.rdp-disabled .rdp-day_button {
|
|
11074
|
-
color: var(--wui-color-text-disabled);
|
|
11075
|
-
font-weight: var(--wui-typography-weight-body);
|
|
11076
|
-
cursor: not-allowed;
|
|
11077
|
-
}
|
|
11078
|
-
|
|
11079
|
-
/* Day button — disabled + selected (forced state: match disabled button) */
|
|
11080
|
-
.rdp-selected.rdp-disabled .rdp-day_button {
|
|
11081
|
-
background-color: var(--wui-color-bg-surface-disabled);
|
|
11082
|
-
color: var(--wui-color-text-disabled);
|
|
11083
|
-
}
|
|
11084
|
-
|
|
11085
|
-
/* Range — cell backgrounds (the connecting band on the <td>) */
|
|
11086
|
-
.rdp-range_start {
|
|
11087
|
-
border-top-left-radius: var(--wui-border-radius-rounded);
|
|
11088
|
-
border-bottom-left-radius: var(--wui-border-radius-rounded);
|
|
11089
|
-
background-color: var(--wui-color-bg-surface-selected);
|
|
11090
|
-
}
|
|
11091
|
-
|
|
11092
|
-
.rdp-range_end {
|
|
11093
|
-
border-top-right-radius: var(--wui-border-radius-rounded);
|
|
11094
|
-
border-bottom-right-radius: var(--wui-border-radius-rounded);
|
|
11095
|
-
background-color: var(--wui-color-bg-surface-selected);
|
|
11096
|
-
}
|
|
11097
|
-
|
|
11098
|
-
.rdp-range_middle {
|
|
11099
|
-
background-color: var(--wui-color-bg-surface-selected);
|
|
11100
|
-
}
|
|
11101
|
-
|
|
11102
|
-
.rdp-range_start.rdp-range_end {
|
|
11103
|
-
background-color: transparent;
|
|
11104
|
-
}
|
|
11105
|
-
|
|
11106
|
-
/* Range — button overrides */
|
|
11107
|
-
.rdp-range_start .rdp-day_button,
|
|
11108
|
-
.rdp-range_end .rdp-day_button {
|
|
11109
|
-
background-color: var(--wui-color-bg-fill);
|
|
11110
|
-
color: var(--wui-color-text-on-fill);
|
|
11111
|
-
}
|
|
11112
|
-
|
|
11113
|
-
.rdp-range_middle .rdp-day_button {
|
|
11114
|
-
color: var(--wui-color-text-selected);
|
|
11115
|
-
background: none;
|
|
11116
|
-
|
|
11117
|
-
&:hover:not([disabled]) {
|
|
11118
|
-
background-color: var(--wui-color-bg-surface-selected-hover);
|
|
11119
|
-
}
|
|
11120
10698
|
}
|
|
11121
|
-
|
|
11122
|
-
/* Hidden */
|
|
11123
|
-
.rdp-hidden {
|
|
11124
|
-
visibility: hidden;
|
|
11125
|
-
}
|
|
11126
|
-
`;
|
|
11127
|
-
//#endregion
|
|
11128
|
-
//#region src/private/components/Calendar/Calendar.tsx
|
|
11129
|
-
const StyledCalendarWrapper = styled.div`
|
|
11130
|
-
${calendarCss}
|
|
11131
10699
|
`;
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
const
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
* @daypicker/react and styled with WUI design tokens.
|
|
11140
|
-
*/
|
|
11141
|
-
const Calendar = (props) => {
|
|
11142
|
-
const { mode, selected, onSelect, month, defaultMonth, onMonthChange, startMonth, endMonth, disabled, numberOfMonths = 1, showOutsideDays, weekStartsOn, today, ...rest } = props;
|
|
11143
|
-
const rangeMin = mode === "range" ? props.min : void 0;
|
|
11144
|
-
const rangeMax = mode === "range" ? props.max : void 0;
|
|
11145
|
-
const dayPickerProps = stripUndefined({
|
|
11146
|
-
...mode === "range" ? {
|
|
11147
|
-
mode: "range",
|
|
11148
|
-
selected,
|
|
11149
|
-
onSelect,
|
|
11150
|
-
min: rangeMin,
|
|
11151
|
-
max: rangeMax
|
|
11152
|
-
} : {
|
|
11153
|
-
mode: "single",
|
|
11154
|
-
selected,
|
|
11155
|
-
onSelect
|
|
11156
|
-
},
|
|
11157
|
-
components: { Nav: CalendarNavigation },
|
|
11158
|
-
defaultMonth,
|
|
11159
|
-
disabled,
|
|
11160
|
-
endMonth,
|
|
11161
|
-
month,
|
|
11162
|
-
numberOfMonths,
|
|
11163
|
-
onMonthChange,
|
|
11164
|
-
showOutsideDays,
|
|
11165
|
-
startMonth,
|
|
11166
|
-
today,
|
|
11167
|
-
weekStartsOn
|
|
11168
|
-
});
|
|
11169
|
-
return /* @__PURE__ */ jsx(StyledCalendarWrapper, {
|
|
11170
|
-
...rest,
|
|
11171
|
-
children: /* @__PURE__ */ jsx(DayPicker, { ...dayPickerProps })
|
|
11172
|
-
});
|
|
11173
|
-
};
|
|
11174
|
-
Calendar.displayName = "Calendar";
|
|
11175
|
-
//#endregion
|
|
11176
|
-
//#region src/components/DatePicker/DatePickerPopover.tsx
|
|
11177
|
-
const DatePickerPopover = () => {
|
|
11178
|
-
const { selectedDate, previewDate, displayedMonth, align, side, minDate, maxDate, disabledDates, popoverId, inputRef, popoverContentRef, handleDaySelect, handleCancel, setDisplayedMonth } = useDatePickerContext();
|
|
11179
|
-
const disabledMatcher = buildDisabledMatcher(minDate, maxDate, disabledDates);
|
|
11180
|
-
const handleOpenAutoFocus = (event) => {
|
|
11181
|
-
event.preventDefault();
|
|
11182
|
-
};
|
|
11183
|
-
const handleCloseAutoFocus = (event) => {
|
|
11184
|
-
event.preventDefault();
|
|
11185
|
-
};
|
|
11186
|
-
const handlePointerDownOutside = (event) => {
|
|
11187
|
-
const { target } = event.detail.originalEvent;
|
|
11188
|
-
if (target instanceof Node && inputRef.current?.contains(target)) event.preventDefault();
|
|
11189
|
-
};
|
|
11190
|
-
const handleEscapeKeyDown = (event) => {
|
|
11191
|
-
event.preventDefault();
|
|
11192
|
-
handleCancel();
|
|
10700
|
+
const EditableTextDisplayComponent = ({ ref, asTrigger, renderAs, ...props }) => {
|
|
10701
|
+
const context = useContext(EditableTextContext);
|
|
10702
|
+
if (!context) throw new Error("EditableTextDisplay must be used within an EditableTextRoot context");
|
|
10703
|
+
const { value, typographicVariant, setIsEditing, placeholder, maxLines, isEditing, minLines } = context;
|
|
10704
|
+
const triggerButtonRef = useRef(null);
|
|
10705
|
+
const handleTriggerClick = () => {
|
|
10706
|
+
setIsEditing(true);
|
|
11193
10707
|
};
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
};
|
|
11216
|
-
DatePickerPopover.displayName = "DatePickerPopover_UI";
|
|
11217
|
-
//#endregion
|
|
11218
|
-
//#region src/components/DatePicker/DatePicker.tsx
|
|
11219
|
-
/**
|
|
11220
|
-
* A date picker that combines a text input with natural language parsing
|
|
11221
|
-
* and a calendar popover for visual date selection.
|
|
11222
|
-
*/
|
|
11223
|
-
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) => {
|
|
11224
|
-
const isControlled = value !== void 0;
|
|
11225
|
-
const [internalDate, setInternalDate] = useState(defaultValue ?? null);
|
|
11226
|
-
const selectedDate = isControlled ? value : internalDate;
|
|
11227
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
11228
|
-
const [inputText, setInputText] = useState(() => formatDate(selectedDate));
|
|
11229
|
-
const [previewDate, setPreviewDate] = useState(null);
|
|
11230
|
-
const [displayedMonth, setDisplayedMonth] = useState(() => selectedDate ?? /* @__PURE__ */ new Date());
|
|
11231
|
-
const inputRef = useRef(null);
|
|
11232
|
-
const popoverContentRef = useRef(null);
|
|
11233
|
-
const skipNextCommitRef = useRef(false);
|
|
11234
|
-
const popoverId = useId();
|
|
11235
|
-
const { isSmAndDown } = useMq();
|
|
11236
|
-
const commitDate = useCallback((date) => {
|
|
11237
|
-
if (isControlled) onChange(date);
|
|
11238
|
-
else setInternalDate(date);
|
|
11239
|
-
setInputText(formatDate(date));
|
|
11240
|
-
setPreviewDate(null);
|
|
11241
|
-
}, [isControlled, onChange]);
|
|
11242
|
-
const handleInputChange = useCallback((text) => {
|
|
11243
|
-
setInputText(text);
|
|
11244
|
-
const parsed = parseDateString(text);
|
|
11245
|
-
if (parsed !== null) {
|
|
11246
|
-
const inRange = isDateInRange(parsed, minDate, maxDate);
|
|
11247
|
-
const isDisabled = isDateDisabled(parsed, disabledDates);
|
|
11248
|
-
if (inRange && !isDisabled) {
|
|
11249
|
-
setPreviewDate(parsed);
|
|
11250
|
-
setDisplayedMonth(parsed);
|
|
11251
|
-
} else setPreviewDate(null);
|
|
11252
|
-
} else setPreviewDate(null);
|
|
11253
|
-
}, [
|
|
11254
|
-
minDate,
|
|
11255
|
-
maxDate,
|
|
11256
|
-
disabledDates
|
|
11257
|
-
]);
|
|
11258
|
-
const handleCommit = useCallback(() => {
|
|
11259
|
-
if (previewDate !== null) {
|
|
11260
|
-
commitDate(previewDate);
|
|
11261
|
-
setIsOpen(false);
|
|
11262
|
-
return;
|
|
11263
|
-
}
|
|
11264
|
-
setInputText(formatDate(selectedDate));
|
|
11265
|
-
setPreviewDate(null);
|
|
11266
|
-
}, [
|
|
11267
|
-
previewDate,
|
|
11268
|
-
selectedDate,
|
|
11269
|
-
commitDate
|
|
11270
|
-
]);
|
|
11271
|
-
const handleCancel = useCallback(() => {
|
|
11272
|
-
skipNextCommitRef.current = true;
|
|
11273
|
-
setInputText(formatDate(selectedDate));
|
|
11274
|
-
setPreviewDate(null);
|
|
11275
|
-
setIsOpen(false);
|
|
11276
|
-
inputRef.current?.focus();
|
|
11277
|
-
}, [selectedDate]);
|
|
11278
|
-
const openPopover = useCallback(() => {
|
|
11279
|
-
setDisplayedMonth(selectedDate ?? /* @__PURE__ */ new Date());
|
|
11280
|
-
setIsOpen(true);
|
|
11281
|
-
}, [selectedDate]);
|
|
11282
|
-
const handleDaySelect = useCallback((date) => {
|
|
11283
|
-
if (date !== void 0) {
|
|
11284
|
-
skipNextCommitRef.current = true;
|
|
11285
|
-
commitDate(date);
|
|
11286
|
-
setDisplayedMonth(date);
|
|
11287
|
-
setIsOpen(false);
|
|
11288
|
-
inputRef.current?.focus();
|
|
11289
|
-
requestAnimationFrame(() => {
|
|
11290
|
-
const input = inputRef.current;
|
|
11291
|
-
if (input instanceof HTMLInputElement) input.setSelectionRange(input.value.length, input.value.length);
|
|
11292
|
-
});
|
|
11293
|
-
}
|
|
11294
|
-
}, [commitDate]);
|
|
11295
|
-
const handleOpenChange = useCallback((open) => {
|
|
11296
|
-
if (open) setDisplayedMonth(selectedDate ?? /* @__PURE__ */ new Date());
|
|
11297
|
-
else if (skipNextCommitRef.current) skipNextCommitRef.current = false;
|
|
11298
|
-
else handleCommit();
|
|
11299
|
-
setIsOpen(open);
|
|
11300
|
-
}, [handleCommit, selectedDate]);
|
|
11301
|
-
useEffect(() => {
|
|
11302
|
-
if (!isControlled) return;
|
|
11303
|
-
setInputText(formatDate(value));
|
|
11304
|
-
setPreviewDate(null);
|
|
11305
|
-
if (value !== null) setDisplayedMonth(value);
|
|
11306
|
-
}, [isControlled, value]);
|
|
11307
|
-
const contextValue = useMemo(() => ({
|
|
11308
|
-
selectedDate,
|
|
11309
|
-
isOpen,
|
|
11310
|
-
inputText,
|
|
11311
|
-
previewDate,
|
|
11312
|
-
displayedMonth,
|
|
11313
|
-
disabled,
|
|
11314
|
-
isMobile: isSmAndDown,
|
|
11315
|
-
align,
|
|
11316
|
-
side,
|
|
11317
|
-
minDate,
|
|
11318
|
-
maxDate,
|
|
11319
|
-
disabledDates,
|
|
11320
|
-
popoverId,
|
|
11321
|
-
inputRef,
|
|
11322
|
-
popoverContentRef,
|
|
11323
|
-
setIsOpen,
|
|
11324
|
-
setInputText,
|
|
11325
|
-
handleInputChange,
|
|
11326
|
-
handleCommit,
|
|
11327
|
-
handleCancel,
|
|
11328
|
-
handleDaySelect,
|
|
11329
|
-
openPopover,
|
|
11330
|
-
setDisplayedMonth
|
|
11331
|
-
}), [
|
|
11332
|
-
selectedDate,
|
|
11333
|
-
isOpen,
|
|
11334
|
-
inputText,
|
|
11335
|
-
previewDate,
|
|
11336
|
-
displayedMonth,
|
|
11337
|
-
disabled,
|
|
11338
|
-
isSmAndDown,
|
|
11339
|
-
align,
|
|
11340
|
-
side,
|
|
11341
|
-
minDate,
|
|
11342
|
-
maxDate,
|
|
11343
|
-
disabledDates,
|
|
11344
|
-
popoverId,
|
|
11345
|
-
handleInputChange,
|
|
11346
|
-
handleCommit,
|
|
11347
|
-
handleCancel,
|
|
11348
|
-
handleDaySelect,
|
|
11349
|
-
openPopover
|
|
11350
|
-
]);
|
|
11351
|
-
return /* @__PURE__ */ jsx("div", {
|
|
11352
|
-
ref,
|
|
11353
|
-
...rest,
|
|
11354
|
-
children: /* @__PURE__ */ jsx(PopoverRoot, {
|
|
11355
|
-
isOpen,
|
|
11356
|
-
onOpenChange: handleOpenChange,
|
|
11357
|
-
children: /* @__PURE__ */ jsxs(DatePickerProvider, {
|
|
11358
|
-
value: contextValue,
|
|
11359
|
-
children: [/* @__PURE__ */ jsx(DatePickerInput, {
|
|
11360
|
-
"aria-describedby": ariaDescribedBy,
|
|
11361
|
-
"aria-invalid": ariaInvalid,
|
|
11362
|
-
fullWidth,
|
|
11363
|
-
id,
|
|
11364
|
-
name,
|
|
11365
|
-
placeholder
|
|
11366
|
-
}), /* @__PURE__ */ jsx(DatePickerPopover, {})]
|
|
11367
|
-
})
|
|
10708
|
+
const elementType = renderAs ?? getDefaultTypographicElement(typographicVariant);
|
|
10709
|
+
const displayText = value.length > 0 ? value : placeholder;
|
|
10710
|
+
const isPlaceholderVisible = value.length === 0 && Boolean(placeholder);
|
|
10711
|
+
if (isEditing) return null;
|
|
10712
|
+
if (asTrigger && !context.readOnly) return /* @__PURE__ */ jsx(ClickRegion, {
|
|
10713
|
+
targetRef: triggerButtonRef,
|
|
10714
|
+
children: /* @__PURE__ */ jsxs(StyledEditableTextDisplay, {
|
|
10715
|
+
ref,
|
|
10716
|
+
$maxLines: maxLines,
|
|
10717
|
+
$minLines: minLines,
|
|
10718
|
+
$typographicVariant: typographicVariant,
|
|
10719
|
+
as: elementType,
|
|
10720
|
+
"data-wui-editable-text-display": isPlaceholderVisible ? "placeholder" : "value",
|
|
10721
|
+
...props,
|
|
10722
|
+
children: [displayText, /* @__PURE__ */ jsx("button", {
|
|
10723
|
+
ref: triggerButtonRef,
|
|
10724
|
+
onClick: handleTriggerClick,
|
|
10725
|
+
style: { ...visuallyHiddenStyle },
|
|
10726
|
+
type: "button",
|
|
10727
|
+
children: "Edit text"
|
|
10728
|
+
})]
|
|
11368
10729
|
})
|
|
11369
10730
|
});
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
margin-left: var(--wui-divider-inset);
|
|
11381
|
-
margin-right: var(--wui-divider-inset);
|
|
11382
|
-
`;
|
|
11383
|
-
const verticalBorderCss = css`
|
|
11384
|
-
background-color: var(--wui-color-border);
|
|
11385
|
-
max-width: 1px;
|
|
11386
|
-
min-height: 100%;
|
|
11387
|
-
width: 1px;
|
|
11388
|
-
margin-top: var(--wui-divider-inset);
|
|
11389
|
-
margin-bottom: var(--wui-divider-inset);
|
|
11390
|
-
`;
|
|
11391
|
-
const DividerComponent = styled.div`
|
|
11392
|
-
${({ $orientation }) => {
|
|
11393
|
-
switch ($orientation) {
|
|
11394
|
-
case "vertical": return verticalBorderCss;
|
|
11395
|
-
default: return horizontalBorderCss;
|
|
11396
|
-
}
|
|
11397
|
-
}}
|
|
11398
|
-
--wui-divider-inset: ${({ $inset }) => `var(--wui-${$inset})`};
|
|
11399
|
-
|
|
11400
|
-
align-self: stretch;
|
|
11401
|
-
`;
|
|
11402
|
-
/**
|
|
11403
|
-
* A line used to visually separate content; note that dividers have no external margin/spacing on their own.
|
|
11404
|
-
*/
|
|
11405
|
-
const Divider = ({ orientation = "horizontal", inset = "space-00", ...props }) => {
|
|
11406
|
-
const responsiveOrientation = useResponsiveProp(orientation);
|
|
11407
|
-
return /* @__PURE__ */ jsx(DividerComponent, {
|
|
11408
|
-
$inset: useResponsiveProp(inset),
|
|
11409
|
-
$orientation: responsiveOrientation,
|
|
11410
|
-
"aria-orientation": responsiveOrientation,
|
|
11411
|
-
role: "separator",
|
|
11412
|
-
...props
|
|
10731
|
+
return /* @__PURE__ */ jsx(StyledEditableTextDisplay, {
|
|
10732
|
+
ref,
|
|
10733
|
+
$maxLines: maxLines,
|
|
10734
|
+
$minLines: minLines,
|
|
10735
|
+
$typographicVariant: typographicVariant,
|
|
10736
|
+
as: elementType,
|
|
10737
|
+
"data-placeholder-visible": isPlaceholderVisible || void 0,
|
|
10738
|
+
"data-wui-editable-text-display": true,
|
|
10739
|
+
...props,
|
|
10740
|
+
children: displayText
|
|
11413
10741
|
});
|
|
11414
10742
|
};
|
|
11415
|
-
|
|
10743
|
+
const EditableTextDisplay = makePolymorphic(EditableTextDisplayComponent);
|
|
11416
10744
|
//#endregion
|
|
11417
|
-
//#region src/components/
|
|
11418
|
-
const StyledInput
|
|
11419
|
-
&:not([rows]) {
|
|
11420
|
-
min-height: unset;
|
|
11421
|
-
}
|
|
11422
|
-
|
|
11423
|
-
&:focus {
|
|
11424
|
-
height: ${({ $height }) => `${$height}px !important`};
|
|
11425
|
-
}
|
|
11426
|
-
|
|
10745
|
+
//#region src/components/EditableText/EditableTextInput.tsx
|
|
10746
|
+
const StyledInput = styled(Input)`
|
|
11427
10747
|
&& {
|
|
11428
|
-
${({ $
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
font-family: var(--font-family);
|
|
11435
|
-
width: 100%;
|
|
11436
|
-
padding: var(--wui-space-02);
|
|
11437
|
-
border: none;
|
|
11438
|
-
height: ${({ $height }) => `${$height}px`};
|
|
11439
|
-
min-height: ${({ $height }) => `${$height}px`};
|
|
10748
|
+
${({ $minLines }) => isNotNil($minLines) && `min-height: calc(${$minLines}lh + calc(var(--wui-editable-text-padding) * 2));`}
|
|
10749
|
+
${({ $maxLines }) => isNotNil($maxLines) && `max-height: calc(${$maxLines}lh + calc(var(--wui-editable-text-padding) * 2));`}
|
|
10750
|
+
${({ $typographicVariant }) => getTypographicStyles($typographicVariant)}
|
|
10751
|
+
background-color: var(--wui-color-bg-surface);
|
|
10752
|
+
border-radius: var(--wui-editable-text-border-radius);
|
|
10753
|
+
padding: var(--wui-editable-text-padding);
|
|
11440
10754
|
resize: none;
|
|
11441
10755
|
}
|
|
11442
10756
|
`;
|
|
11443
|
-
const
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
* A special heading component that allows for inline editing. When clicked or activated via keyboard,
|
|
11463
|
-
* it transforms into an editable text field. In its default state, it renders as a heading with
|
|
11464
|
-
* an accessible button that enables editing mode. The component handles empty values, keyboard
|
|
11465
|
-
* navigation (Enter to save, Escape to cancel), and provides callbacks for value and state changes.
|
|
11466
|
-
*/
|
|
11467
|
-
const EditableHeading = ({ children, onValueChange, onEditingChange, tooltipText = "Click to edit title", ariaLabel = "Edit title", variant = "heading1", __forceEditing = false, editingDisabled = false }) => {
|
|
11468
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
11469
|
-
const [value, setValue] = useState(children);
|
|
11470
|
-
const [previousValue, setPreviousValue] = useState(children);
|
|
11471
|
-
const [headingHeight, setHeadingHeight] = useState("60");
|
|
11472
|
-
const headingRef = useRef(null);
|
|
11473
|
-
const handleSetEditing = (editing) => {
|
|
11474
|
-
if (editingDisabled) return;
|
|
11475
|
-
if (editing && headingRef.current) setHeadingHeight(`${headingRef.current.offsetHeight}`);
|
|
11476
|
-
if (editing) setPreviousValue(value);
|
|
11477
|
-
setIsEditing(editing);
|
|
11478
|
-
onEditingChange?.(editing);
|
|
11479
|
-
};
|
|
11480
|
-
const handleFinishEditing = () => {
|
|
11481
|
-
const trimmedValue = value.trim();
|
|
11482
|
-
if (trimmedValue === "") setValue(previousValue);
|
|
11483
|
-
else if (trimmedValue !== previousValue && onValueChange) onValueChange(trimmedValue);
|
|
11484
|
-
else setValue(trimmedValue);
|
|
11485
|
-
handleSetEditing(false);
|
|
10757
|
+
const EditableTextInput = (props) => {
|
|
10758
|
+
const context = useContext(EditableTextContext);
|
|
10759
|
+
if (!context) throw new Error("EditableTextInput must be used within an EditableTextRoot context");
|
|
10760
|
+
const { isEditing, value, setValue, onValueCommit, setIsEditing, typographicVariant, submitMode, originalValue, onValueRevert, id, placeholder, minLines, maxLines, finalFocusEl } = context;
|
|
10761
|
+
const inputRef = useRef(null);
|
|
10762
|
+
useEffect(() => {
|
|
10763
|
+
if (inputRef.current) {
|
|
10764
|
+
if (isEditing) {
|
|
10765
|
+
const element = inputRef.current;
|
|
10766
|
+
const { style } = element;
|
|
10767
|
+
style.height = "0px";
|
|
10768
|
+
const { scrollHeight } = element;
|
|
10769
|
+
style.height = `${scrollHeight}px`;
|
|
10770
|
+
}
|
|
10771
|
+
if (isEditing) inputRef.current.focus();
|
|
10772
|
+
}
|
|
10773
|
+
}, [value, isEditing]);
|
|
10774
|
+
const handleChange = (event) => {
|
|
10775
|
+
setValue(event.target.value);
|
|
11486
10776
|
};
|
|
11487
10777
|
const handleKeyDown = (event) => {
|
|
11488
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
10778
|
+
if ((submitMode === "enter" || submitMode === "both") && event.key === "Enter" && !event.shiftKey) {
|
|
11489
10779
|
event.preventDefault();
|
|
11490
|
-
|
|
10780
|
+
onValueCommit?.(value);
|
|
10781
|
+
setIsEditing(false);
|
|
10782
|
+
setTimeout(() => {
|
|
10783
|
+
const element = finalFocusEl?.();
|
|
10784
|
+
if (element) element.focus();
|
|
10785
|
+
}, 0);
|
|
11491
10786
|
}
|
|
11492
10787
|
if (event.key === "Escape") {
|
|
11493
|
-
|
|
11494
|
-
|
|
10788
|
+
event.preventDefault();
|
|
10789
|
+
setValue(originalValue);
|
|
10790
|
+
onValueRevert?.(originalValue);
|
|
10791
|
+
setIsEditing(false);
|
|
10792
|
+
setTimeout(() => {
|
|
10793
|
+
const element = finalFocusEl?.();
|
|
10794
|
+
if (element) element.focus();
|
|
10795
|
+
}, 0);
|
|
11495
10796
|
}
|
|
11496
10797
|
};
|
|
11497
|
-
const
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
10798
|
+
const handleBlur = () => {
|
|
10799
|
+
if (submitMode === "blur" || submitMode === "both") {
|
|
10800
|
+
onValueCommit?.(value);
|
|
10801
|
+
setIsEditing(false);
|
|
10802
|
+
setTimeout(() => {
|
|
10803
|
+
const element = finalFocusEl?.();
|
|
10804
|
+
if (element) element.focus();
|
|
10805
|
+
}, 0);
|
|
10806
|
+
}
|
|
10807
|
+
};
|
|
10808
|
+
if (!isEditing) return null;
|
|
10809
|
+
return /* @__PURE__ */ jsx(StyledInput, {
|
|
10810
|
+
ref: inputRef,
|
|
10811
|
+
$maxLines: maxLines ?? "infinity",
|
|
10812
|
+
$minLines: minLines,
|
|
10813
|
+
$typographicVariant: typographicVariant,
|
|
10814
|
+
"data-wui-editable-text-input": true,
|
|
10815
|
+
id,
|
|
10816
|
+
onBlur: handleBlur,
|
|
10817
|
+
onChange: handleChange,
|
|
11512
10818
|
onFocus: (event) => {
|
|
11513
10819
|
const { length } = event.currentTarget.value;
|
|
11514
10820
|
event.currentTarget.setSelectionRange(length, length);
|
|
11515
10821
|
},
|
|
11516
10822
|
onKeyDown: handleKeyDown,
|
|
10823
|
+
placeholder,
|
|
11517
10824
|
type: "multiline",
|
|
11518
|
-
value
|
|
11519
|
-
});
|
|
11520
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
11521
|
-
content: tooltipText,
|
|
11522
|
-
children: HeadingComponent
|
|
11523
|
-
}), /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx("button", {
|
|
11524
|
-
"aria-label": ariaLabel,
|
|
11525
|
-
onClick: () => handleSetEditing(true),
|
|
11526
|
-
type: "button"
|
|
11527
|
-
}) })] });
|
|
11528
|
-
};
|
|
11529
|
-
//#endregion
|
|
11530
|
-
//#region src/components/EditableText/EditableTextRoot.tsx
|
|
11531
|
-
const LARGE_PADDING = "var(--wui-space-02)";
|
|
11532
|
-
const SMALL_PADDING = "var(--wui-space-01)";
|
|
11533
|
-
const getPaddingForVariant = (variant) => {
|
|
11534
|
-
const largePaddingVariants = [
|
|
11535
|
-
"hero",
|
|
11536
|
-
"heading1",
|
|
11537
|
-
"heading2",
|
|
11538
|
-
"heading3",
|
|
11539
|
-
"body1",
|
|
11540
|
-
"label1",
|
|
11541
|
-
"body1Mono"
|
|
11542
|
-
];
|
|
11543
|
-
const smallPaddingVariants = [
|
|
11544
|
-
"heading4",
|
|
11545
|
-
"heading5",
|
|
11546
|
-
"heading6",
|
|
11547
|
-
"body2",
|
|
11548
|
-
"body3",
|
|
11549
|
-
"body4",
|
|
11550
|
-
"label2",
|
|
11551
|
-
"label3",
|
|
11552
|
-
"label4",
|
|
11553
|
-
"body2Mono",
|
|
11554
|
-
"body3Mono",
|
|
11555
|
-
"body4Mono"
|
|
11556
|
-
];
|
|
11557
|
-
if (largePaddingVariants.includes(variant)) return LARGE_PADDING;
|
|
11558
|
-
if (smallPaddingVariants.includes(variant)) return SMALL_PADDING;
|
|
11559
|
-
return SMALL_PADDING;
|
|
11560
|
-
};
|
|
11561
|
-
const StyledEditableTextRoot = styled.div`
|
|
11562
|
-
display: contents;
|
|
11563
|
-
|
|
11564
|
-
--wui-editable-text-padding: ${({ $typographicVariant }) => getPaddingForVariant($typographicVariant)};
|
|
11565
|
-
--wui-editable-text-border-radius: var(--wui-border-radius-01);
|
|
11566
|
-
`;
|
|
11567
|
-
const EditableTextContext = createContext(null);
|
|
11568
|
-
const EditableTextRoot = ({ children, defaultValue = "", value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant = "body2", submitMode = "both", readOnly = false, id, label, placeholder = "Click to edit this text", minLines = 1, maxLines, finalFocusEl, ...props }) => {
|
|
11569
|
-
const isControlled = controlledValue !== void 0;
|
|
11570
|
-
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
11571
|
-
const [originalValue, setOriginalValue] = useState(defaultValue);
|
|
11572
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
11573
|
-
const value = isControlled ? controlledValue : internalValue;
|
|
11574
|
-
const generatedId = useId();
|
|
11575
|
-
const computedId = isNonEmptyString(id) ? id : `wistia-ui-editable-text-${generatedId}`;
|
|
11576
|
-
const handleSetIsEditing = useCallback((editing) => {
|
|
11577
|
-
if (editing && !isEditing) setOriginalValue(value);
|
|
11578
|
-
setIsEditing(editing);
|
|
11579
|
-
onEditingChange?.(editing);
|
|
11580
|
-
}, [
|
|
11581
|
-
isEditing,
|
|
11582
|
-
value,
|
|
11583
|
-
onEditingChange
|
|
11584
|
-
]);
|
|
11585
|
-
const setValue = useCallback((newValue) => {
|
|
11586
|
-
if (!isControlled) setInternalValue(newValue);
|
|
11587
|
-
onValueChange?.(newValue);
|
|
11588
|
-
}, [isControlled, onValueChange]);
|
|
11589
|
-
const context = useMemo(() => {
|
|
11590
|
-
return {
|
|
11591
|
-
isEditing,
|
|
11592
|
-
setIsEditing: handleSetIsEditing,
|
|
11593
|
-
value,
|
|
11594
|
-
setValue,
|
|
11595
|
-
originalValue,
|
|
11596
|
-
onValueCommit,
|
|
11597
|
-
onValueRevert,
|
|
11598
|
-
typographicVariant,
|
|
11599
|
-
submitMode,
|
|
11600
|
-
readOnly,
|
|
11601
|
-
id: computedId,
|
|
11602
|
-
label,
|
|
11603
|
-
placeholder,
|
|
11604
|
-
minLines,
|
|
11605
|
-
maxLines,
|
|
11606
|
-
finalFocusEl
|
|
11607
|
-
};
|
|
11608
|
-
}, [
|
|
11609
|
-
isEditing,
|
|
11610
|
-
handleSetIsEditing,
|
|
11611
10825
|
value,
|
|
11612
|
-
|
|
11613
|
-
originalValue,
|
|
11614
|
-
onValueCommit,
|
|
11615
|
-
onValueRevert,
|
|
11616
|
-
typographicVariant,
|
|
11617
|
-
submitMode,
|
|
11618
|
-
readOnly,
|
|
11619
|
-
computedId,
|
|
11620
|
-
label,
|
|
11621
|
-
placeholder,
|
|
11622
|
-
minLines,
|
|
11623
|
-
maxLines,
|
|
11624
|
-
finalFocusEl
|
|
11625
|
-
]);
|
|
11626
|
-
const getState = () => {
|
|
11627
|
-
if (readOnly) return "read-only";
|
|
11628
|
-
if (isEditing) return "editing";
|
|
11629
|
-
return "idle";
|
|
11630
|
-
};
|
|
11631
|
-
return /* @__PURE__ */ jsx(StyledEditableTextRoot, {
|
|
11632
|
-
$typographicVariant: typographicVariant,
|
|
11633
|
-
"data-testid": "editable-text-root",
|
|
11634
|
-
"data-wui-editable-text-root": true,
|
|
11635
|
-
"data-wui-editable-text-state": getState(),
|
|
11636
|
-
...props,
|
|
11637
|
-
children: /* @__PURE__ */ jsx(EditableTextContext, {
|
|
11638
|
-
value: context,
|
|
11639
|
-
children
|
|
11640
|
-
})
|
|
10826
|
+
...props
|
|
11641
10827
|
});
|
|
11642
10828
|
};
|
|
11643
10829
|
//#endregion
|
|
11644
|
-
//#region src/components/EditableText/
|
|
11645
|
-
const
|
|
11646
|
-
${({ $typographicVariant }) => getTypographicStyles($typographicVariant)}
|
|
11647
|
-
padding: var(--wui-editable-text-padding);
|
|
11648
|
-
border-radius: var(--wui-editable-text-border-radius);
|
|
11649
|
-
margin: 0;
|
|
11650
|
-
transition: all var(--wui-motion-duration-02) var(--wui-motion-ease);
|
|
11651
|
-
${({ $maxLines }) => {
|
|
11652
|
-
if (isNotNil($maxLines)) return css`
|
|
11653
|
-
${ellipsisStyle};
|
|
11654
|
-
${lineClampCss($maxLines)};
|
|
11655
|
-
`;
|
|
11656
|
-
}}
|
|
11657
|
-
${({ $minLines }) => isNotNil($minLines) && css`
|
|
11658
|
-
min-height: calc(${$minLines}lh + calc(var(--wui-editable-text-padding) * 2));
|
|
11659
|
-
`}
|
|
11660
|
-
word-break: normal;
|
|
11661
|
-
overflow-wrap: anywhere;
|
|
11662
|
-
|
|
11663
|
-
&[data-wui-editable-text-display='placeholder'] {
|
|
11664
|
-
color: var(--wui-color-text-secondary);
|
|
11665
|
-
}
|
|
11666
|
-
|
|
11667
|
-
&:has(button) {
|
|
11668
|
-
user-select: none;
|
|
11669
|
-
cursor: pointer;
|
|
11670
|
-
|
|
11671
|
-
&:hover,
|
|
11672
|
-
&:focus-within {
|
|
11673
|
-
background-color: var(--wui-color-bg-surface-hover);
|
|
11674
|
-
}
|
|
11675
|
-
}
|
|
11676
|
-
`;
|
|
11677
|
-
const EditableTextDisplayComponent = ({ ref, asTrigger, renderAs, ...props }) => {
|
|
10830
|
+
//#region src/components/EditableText/EditableTextLabel.tsx
|
|
10831
|
+
const EditableTextLabel = ({ ...props }) => {
|
|
11678
10832
|
const context = useContext(EditableTextContext);
|
|
11679
|
-
if (!context) throw new Error("
|
|
11680
|
-
const {
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
setIsEditing(true);
|
|
11684
|
-
};
|
|
11685
|
-
const elementType = renderAs ?? getDefaultTypographicElement(typographicVariant);
|
|
11686
|
-
const displayText = value.length > 0 ? value : placeholder;
|
|
11687
|
-
const isPlaceholderVisible = value.length === 0 && Boolean(placeholder);
|
|
11688
|
-
if (isEditing) return null;
|
|
11689
|
-
if (asTrigger && !context.readOnly) return /* @__PURE__ */ jsx(ClickRegion, {
|
|
11690
|
-
targetRef: triggerButtonRef,
|
|
11691
|
-
children: /* @__PURE__ */ jsxs(StyledEditableTextDisplay, {
|
|
11692
|
-
ref,
|
|
11693
|
-
$maxLines: maxLines,
|
|
11694
|
-
$minLines: minLines,
|
|
11695
|
-
$typographicVariant: typographicVariant,
|
|
11696
|
-
as: elementType,
|
|
11697
|
-
"data-wui-editable-text-display": isPlaceholderVisible ? "placeholder" : "value",
|
|
11698
|
-
...props,
|
|
11699
|
-
children: [displayText, /* @__PURE__ */ jsx("button", {
|
|
11700
|
-
ref: triggerButtonRef,
|
|
11701
|
-
onClick: handleTriggerClick,
|
|
11702
|
-
style: { ...visuallyHiddenStyle },
|
|
11703
|
-
type: "button",
|
|
11704
|
-
children: "Edit text"
|
|
11705
|
-
})]
|
|
11706
|
-
})
|
|
11707
|
-
});
|
|
11708
|
-
return /* @__PURE__ */ jsx(StyledEditableTextDisplay, {
|
|
11709
|
-
ref,
|
|
11710
|
-
$maxLines: maxLines,
|
|
11711
|
-
$minLines: minLines,
|
|
11712
|
-
$typographicVariant: typographicVariant,
|
|
11713
|
-
as: elementType,
|
|
11714
|
-
"data-placeholder-visible": isPlaceholderVisible || void 0,
|
|
11715
|
-
"data-wui-editable-text-display": true,
|
|
10833
|
+
if (!context) throw new Error("EditableTextLabel must be used within an EditableTextRoot context");
|
|
10834
|
+
const { id, label, isEditing } = context;
|
|
10835
|
+
return /* @__PURE__ */ jsx(Label, {
|
|
10836
|
+
...isEditing && { htmlFor: id },
|
|
11716
10837
|
...props,
|
|
11717
|
-
children:
|
|
11718
|
-
});
|
|
11719
|
-
};
|
|
11720
|
-
const EditableTextDisplay = makePolymorphic(EditableTextDisplayComponent);
|
|
11721
|
-
//#endregion
|
|
11722
|
-
//#region src/components/EditableText/EditableTextInput.tsx
|
|
11723
|
-
const StyledInput = styled(Input)`
|
|
11724
|
-
&& {
|
|
11725
|
-
${({ $minLines }) => isNotNil($minLines) && `min-height: calc(${$minLines}lh + calc(var(--wui-editable-text-padding) * 2));`}
|
|
11726
|
-
${({ $maxLines }) => isNotNil($maxLines) && `max-height: calc(${$maxLines}lh + calc(var(--wui-editable-text-padding) * 2));`}
|
|
11727
|
-
${({ $typographicVariant }) => getTypographicStyles($typographicVariant)}
|
|
11728
|
-
background-color: var(--wui-color-bg-surface);
|
|
11729
|
-
border-radius: var(--wui-editable-text-border-radius);
|
|
11730
|
-
padding: var(--wui-editable-text-padding);
|
|
11731
|
-
resize: none;
|
|
11732
|
-
}
|
|
11733
|
-
`;
|
|
11734
|
-
const EditableTextInput = (props) => {
|
|
11735
|
-
const context = useContext(EditableTextContext);
|
|
11736
|
-
if (!context) throw new Error("EditableTextInput must be used within an EditableTextRoot context");
|
|
11737
|
-
const { isEditing, value, setValue, onValueCommit, setIsEditing, typographicVariant, submitMode, originalValue, onValueRevert, id, placeholder, minLines, maxLines, finalFocusEl } = context;
|
|
11738
|
-
const inputRef = useRef(null);
|
|
11739
|
-
useEffect(() => {
|
|
11740
|
-
if (inputRef.current) {
|
|
11741
|
-
if (isEditing) {
|
|
11742
|
-
const element = inputRef.current;
|
|
11743
|
-
const { style } = element;
|
|
11744
|
-
style.height = "0px";
|
|
11745
|
-
const { scrollHeight } = element;
|
|
11746
|
-
style.height = `${scrollHeight}px`;
|
|
11747
|
-
}
|
|
11748
|
-
if (isEditing) inputRef.current.focus();
|
|
11749
|
-
}
|
|
11750
|
-
}, [value, isEditing]);
|
|
11751
|
-
const handleChange = (event) => {
|
|
11752
|
-
setValue(event.target.value);
|
|
11753
|
-
};
|
|
11754
|
-
const handleKeyDown = (event) => {
|
|
11755
|
-
if ((submitMode === "enter" || submitMode === "both") && event.key === "Enter" && !event.shiftKey) {
|
|
11756
|
-
event.preventDefault();
|
|
11757
|
-
onValueCommit?.(value);
|
|
11758
|
-
setIsEditing(false);
|
|
11759
|
-
setTimeout(() => {
|
|
11760
|
-
const element = finalFocusEl?.();
|
|
11761
|
-
if (element) element.focus();
|
|
11762
|
-
}, 0);
|
|
11763
|
-
}
|
|
11764
|
-
if (event.key === "Escape") {
|
|
11765
|
-
event.preventDefault();
|
|
11766
|
-
setValue(originalValue);
|
|
11767
|
-
onValueRevert?.(originalValue);
|
|
11768
|
-
setIsEditing(false);
|
|
11769
|
-
setTimeout(() => {
|
|
11770
|
-
const element = finalFocusEl?.();
|
|
11771
|
-
if (element) element.focus();
|
|
11772
|
-
}, 0);
|
|
11773
|
-
}
|
|
11774
|
-
};
|
|
11775
|
-
const handleBlur = () => {
|
|
11776
|
-
if (submitMode === "blur" || submitMode === "both") {
|
|
11777
|
-
onValueCommit?.(value);
|
|
11778
|
-
setIsEditing(false);
|
|
11779
|
-
setTimeout(() => {
|
|
11780
|
-
const element = finalFocusEl?.();
|
|
11781
|
-
if (element) element.focus();
|
|
11782
|
-
}, 0);
|
|
11783
|
-
}
|
|
11784
|
-
};
|
|
11785
|
-
if (!isEditing) return null;
|
|
11786
|
-
return /* @__PURE__ */ jsx(StyledInput, {
|
|
11787
|
-
ref: inputRef,
|
|
11788
|
-
$maxLines: maxLines ?? "infinity",
|
|
11789
|
-
$minLines: minLines,
|
|
11790
|
-
$typographicVariant: typographicVariant,
|
|
11791
|
-
"data-wui-editable-text-input": true,
|
|
11792
|
-
id,
|
|
11793
|
-
onBlur: handleBlur,
|
|
11794
|
-
onChange: handleChange,
|
|
11795
|
-
onFocus: (event) => {
|
|
11796
|
-
const { length } = event.currentTarget.value;
|
|
11797
|
-
event.currentTarget.setSelectionRange(length, length);
|
|
11798
|
-
},
|
|
11799
|
-
onKeyDown: handleKeyDown,
|
|
11800
|
-
placeholder,
|
|
11801
|
-
type: "multiline",
|
|
11802
|
-
value,
|
|
11803
|
-
...props
|
|
11804
|
-
});
|
|
11805
|
-
};
|
|
11806
|
-
//#endregion
|
|
11807
|
-
//#region src/components/EditableText/EditableTextLabel.tsx
|
|
11808
|
-
const EditableTextLabel = ({ ...props }) => {
|
|
11809
|
-
const context = useContext(EditableTextContext);
|
|
11810
|
-
if (!context) throw new Error("EditableTextLabel must be used within an EditableTextRoot context");
|
|
11811
|
-
const { id, label, isEditing } = context;
|
|
11812
|
-
return /* @__PURE__ */ jsx(Label, {
|
|
11813
|
-
...isEditing && { htmlFor: id },
|
|
11814
|
-
...props,
|
|
11815
|
-
children: label
|
|
10838
|
+
children: label
|
|
11816
10839
|
});
|
|
11817
10840
|
};
|
|
11818
10841
|
//#endregion
|
|
@@ -12452,7 +11475,7 @@ const previewCardClose = keyframes`
|
|
|
12452
11475
|
transform: scale(0.96);
|
|
12453
11476
|
}
|
|
12454
11477
|
`;
|
|
12455
|
-
const StyledPopup$
|
|
11478
|
+
const StyledPopup$3 = styled(PreviewCard$1.Popup)`
|
|
12456
11479
|
--preview-card-animation-duration: var(--wui-motion-duration-03);
|
|
12457
11480
|
--preview-card-animation-ease: var(--wui-motion-ease-out);
|
|
12458
11481
|
|
|
@@ -12502,7 +11525,7 @@ const PreviewCard = ({ children, trigger, maxWidth = "320px", maxHeight = "auto"
|
|
|
12502
11525
|
side,
|
|
12503
11526
|
sideOffset: 8,
|
|
12504
11527
|
style: { zIndex: "var(--wui-zindex-popover)" },
|
|
12505
|
-
children: /* @__PURE__ */ jsx(StyledPopup$
|
|
11528
|
+
children: /* @__PURE__ */ jsx(StyledPopup$3, {
|
|
12506
11529
|
$colorScheme: colorScheme,
|
|
12507
11530
|
$paddingSize: paddingSize,
|
|
12508
11531
|
...props,
|
|
@@ -14089,448 +13112,774 @@ const FilterMenu = ({ value, onChange, searchValue, onSearchValueChange, childre
|
|
|
14089
13112
|
});
|
|
14090
13113
|
};
|
|
14091
13114
|
//#endregion
|
|
14092
|
-
//#region src/components/Meter/Meter.tsx
|
|
14093
|
-
const MeterWrapper = styled.div`
|
|
14094
|
-
--meter-height: 16px;
|
|
13115
|
+
//#region src/components/Meter/Meter.tsx
|
|
13116
|
+
const MeterWrapper = styled.div`
|
|
13117
|
+
--meter-height: 16px;
|
|
13118
|
+
|
|
13119
|
+
display: flex;
|
|
13120
|
+
flex-direction: column;
|
|
13121
|
+
gap: var(--wui-space-02);
|
|
13122
|
+
`;
|
|
13123
|
+
const MeterLabelContainer = styled.div`
|
|
13124
|
+
display: flex;
|
|
13125
|
+
justify-content: space-between;
|
|
13126
|
+
align-items: baseline;
|
|
13127
|
+
`;
|
|
13128
|
+
const MeterLabel = styled.div`
|
|
13129
|
+
font-family: var(--wui-typography-heading-5-family);
|
|
13130
|
+
line-height: var(--wui-typography-heading-5-line-height);
|
|
13131
|
+
font-size: var(--wui-typography-heading-5-size);
|
|
13132
|
+
font-weight: var(--wui-typography-heading-5-weight);
|
|
13133
|
+
`;
|
|
13134
|
+
const MeterLabelMeta = styled.div`
|
|
13135
|
+
font-family: var(--wui-typography-heading-5-family);
|
|
13136
|
+
line-height: var(--wui-typography-heading-5-line-height);
|
|
13137
|
+
font-size: var(--wui-typography-heading-5-size);
|
|
13138
|
+
font-weight: var(--wui-typography-heading-5-weight);
|
|
13139
|
+
`;
|
|
13140
|
+
const MeterBarContainer = styled.div`
|
|
13141
|
+
position: relative;
|
|
13142
|
+
overflow: hidden;
|
|
13143
|
+
background-color: var(--wui-color-bg-surface-secondary);
|
|
13144
|
+
border-radius: var(--wui-border-radius-rounded);
|
|
13145
|
+
width: 100%;
|
|
13146
|
+
height: var(--meter-height);
|
|
13147
|
+
transform: translateZ(0);
|
|
13148
|
+
`;
|
|
13149
|
+
const MeterSegmentBar = styled.div`
|
|
13150
|
+
position: absolute;
|
|
13151
|
+
top: 0;
|
|
13152
|
+
left: ${({ $offset }) => $offset}%;
|
|
13153
|
+
width: ${({ $width }) => $width}%;
|
|
13154
|
+
height: 100%;
|
|
13155
|
+
background-color: ${({ $color }) => `var(--wui-${$color})`};
|
|
13156
|
+
|
|
13157
|
+
&:first-child {
|
|
13158
|
+
border-top-left-radius: var(--wui-border-radius-rounded);
|
|
13159
|
+
border-bottom-left-radius: var(--wui-border-radius-rounded);
|
|
13160
|
+
}
|
|
13161
|
+
|
|
13162
|
+
&:last-child {
|
|
13163
|
+
border-top-right-radius: var(--wui-border-radius-rounded);
|
|
13164
|
+
border-bottom-right-radius: var(--wui-border-radius-rounded);
|
|
13165
|
+
}
|
|
13166
|
+
`;
|
|
13167
|
+
const MeterDescription = styled.div`
|
|
13168
|
+
line-height: var(--wui-typography-label-3-line-height);
|
|
13169
|
+
font-size: var(--wui-typography-label-3-size);
|
|
13170
|
+
font-weight: var(--wui-typography-label-3-weight);
|
|
13171
|
+
color: var(--wui-color-text-secondary);
|
|
13172
|
+
`;
|
|
13173
|
+
const MeterKey = styled.div`
|
|
13174
|
+
display: flex;
|
|
13175
|
+
flex-wrap: wrap;
|
|
13176
|
+
gap: var(--wui-space-03);
|
|
13177
|
+
`;
|
|
13178
|
+
const MeterKeyItem = styled.div`
|
|
13179
|
+
display: flex;
|
|
13180
|
+
align-items: center;
|
|
13181
|
+
gap: var(--wui-space-01);
|
|
13182
|
+
`;
|
|
13183
|
+
const MeterKeyColorIndicator = styled.div`
|
|
13184
|
+
width: 8px;
|
|
13185
|
+
height: 8px;
|
|
13186
|
+
border-radius: 50%;
|
|
13187
|
+
background-color: ${({ $color }) => `var(--wui-${$color})`};
|
|
13188
|
+
flex-shrink: 0;
|
|
13189
|
+
`;
|
|
13190
|
+
const MeterKeyLabel = styled.span`
|
|
13191
|
+
line-height: var(--wui-typography-label-3-line-height);
|
|
13192
|
+
font-size: var(--wui-typography-label-3-size);
|
|
13193
|
+
font-weight: var(--wui-typography-label-3-weight);
|
|
13194
|
+
color: var(--wui-color-text-secondary);
|
|
13195
|
+
`;
|
|
13196
|
+
const nodeToString = (node) => {
|
|
13197
|
+
if (typeof node === "string") return node;
|
|
13198
|
+
if (typeof node === "number") return String(node);
|
|
13199
|
+
if (node == null || typeof node === "boolean") return "";
|
|
13200
|
+
if (Array.isArray(node)) return node.map(nodeToString).join("");
|
|
13201
|
+
if (typeof node === "object" && "props" in node) {
|
|
13202
|
+
const element = node;
|
|
13203
|
+
if (element.props?.children != null) return nodeToString(element.props.children);
|
|
13204
|
+
}
|
|
13205
|
+
return "";
|
|
13206
|
+
};
|
|
13207
|
+
/**
|
|
13208
|
+
* A meter component that visually represents one to many segments as portions of a whole
|
|
13209
|
+
*/
|
|
13210
|
+
const Meter = ({ segments, label, labelMeta, description, hideKey = false, max = 100, "aria-label": ariaLabel, ...props }) => {
|
|
13211
|
+
const labelId = useId();
|
|
13212
|
+
const descriptionId = useId();
|
|
13213
|
+
const segmentsWithOffsets = segments.reduce((acc, segment) => {
|
|
13214
|
+
const offset = acc.reduce((sum, prev) => sum + prev.widthPercent, 0);
|
|
13215
|
+
const widthPercent = segment.value / max * 100;
|
|
13216
|
+
acc.push({
|
|
13217
|
+
...segment,
|
|
13218
|
+
offset,
|
|
13219
|
+
widthPercent
|
|
13220
|
+
});
|
|
13221
|
+
return acc;
|
|
13222
|
+
}, []);
|
|
13223
|
+
const keySegments = segmentsWithOffsets.filter((segment) => isNotNil(segment.label));
|
|
13224
|
+
const totalValue = segments.reduce((sum, segment) => sum + segment.value, 0);
|
|
13225
|
+
const generateAriaDescription = () => {
|
|
13226
|
+
const segmentDescriptions = segments.filter((segment) => isNotNil(segment.label)).map((segment) => `${nodeToString(segment.label)}: ${segment.value}%`).join(", ");
|
|
13227
|
+
const totalDescription = `Total: ${totalValue} out of ${max}`;
|
|
13228
|
+
return segmentDescriptions ? `${segmentDescriptions}. ${totalDescription}` : totalDescription;
|
|
13229
|
+
};
|
|
13230
|
+
const effectiveAriaLabel = ariaLabel ?? (isNotNil(label) ? nodeToString(label) : "Data meter");
|
|
13231
|
+
return /* @__PURE__ */ jsxs(MeterWrapper, {
|
|
13232
|
+
...props,
|
|
13233
|
+
children: [
|
|
13234
|
+
/* @__PURE__ */ jsx(ScreenReaderOnly, {
|
|
13235
|
+
id: descriptionId,
|
|
13236
|
+
text: generateAriaDescription()
|
|
13237
|
+
}),
|
|
13238
|
+
isNotNil(label) || isNotNil(labelMeta) ? /* @__PURE__ */ jsxs(MeterLabelContainer, {
|
|
13239
|
+
id: labelId,
|
|
13240
|
+
children: [isNotNil(label) ? /* @__PURE__ */ jsx(MeterLabel, { children: label }) : null, isNotNil(labelMeta) ? /* @__PURE__ */ jsx(MeterLabelMeta, { children: labelMeta }) : null]
|
|
13241
|
+
}) : null,
|
|
13242
|
+
/* @__PURE__ */ jsx(MeterBarContainer, {
|
|
13243
|
+
"aria-describedby": descriptionId,
|
|
13244
|
+
"aria-label": effectiveAriaLabel,
|
|
13245
|
+
"aria-labelledby": isNotNil(label) || isNotNil(labelMeta) ? labelId : void 0,
|
|
13246
|
+
"aria-valuemax": max,
|
|
13247
|
+
"aria-valuemin": 0,
|
|
13248
|
+
"aria-valuenow": totalValue,
|
|
13249
|
+
role: "meter",
|
|
13250
|
+
children: segmentsWithOffsets.map((segment) => /* @__PURE__ */ jsx(MeterSegmentBar, {
|
|
13251
|
+
$color: segment.color,
|
|
13252
|
+
$offset: segment.offset,
|
|
13253
|
+
$width: segment.widthPercent,
|
|
13254
|
+
"aria-hidden": "true"
|
|
13255
|
+
}, `${segment.color}-${segment.value}-${segment.offset}`))
|
|
13256
|
+
}),
|
|
13257
|
+
isNotNil(description) ? /* @__PURE__ */ jsx(MeterDescription, { children: description }) : null,
|
|
13258
|
+
!hideKey && keySegments.length > 0 ? /* @__PURE__ */ jsx(MeterKey, {
|
|
13259
|
+
"aria-label": "Meter legend",
|
|
13260
|
+
role: "list",
|
|
13261
|
+
children: keySegments.map((segment) => /* @__PURE__ */ jsxs(MeterKeyItem, {
|
|
13262
|
+
role: "listitem",
|
|
13263
|
+
children: [/* @__PURE__ */ jsx(MeterKeyColorIndicator, {
|
|
13264
|
+
$color: segment.color,
|
|
13265
|
+
"aria-hidden": "true"
|
|
13266
|
+
}), /* @__PURE__ */ jsx(MeterKeyLabel, { children: segment.label })]
|
|
13267
|
+
}, `${segment.color}-${segment.value}-${segment.offset}-${nodeToString(segment.label)}`))
|
|
13268
|
+
}) : null
|
|
13269
|
+
]
|
|
13270
|
+
});
|
|
13271
|
+
};
|
|
13272
|
+
Meter.displayName = "Meter_UI";
|
|
13273
|
+
//#endregion
|
|
13274
|
+
//#region src/components/Modal/ModalCloseButton.tsx
|
|
13275
|
+
const ModalCloseButton = () => {
|
|
13276
|
+
return /* @__PURE__ */ jsx(Dialog.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
13277
|
+
label: "Dismiss modal",
|
|
13278
|
+
size: "sm",
|
|
13279
|
+
style: { alignSelf: "start" },
|
|
13280
|
+
variant: "ghost",
|
|
13281
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
13282
|
+
}) });
|
|
13283
|
+
};
|
|
13284
|
+
//#endregion
|
|
13285
|
+
//#region src/components/Modal/ModalHeader.tsx
|
|
13286
|
+
const Header = styled.header`
|
|
13287
|
+
display: flex;
|
|
13288
|
+
order: 1;
|
|
13289
|
+
padding: 0 var(--wui-space-05);
|
|
13290
|
+
padding-bottom: 0;
|
|
13291
|
+
gap: var(--wui-space-01);
|
|
13292
|
+
justify-content: ${({ $hideTitle }) => $hideTitle ? "flex-end" : "space-between"}; /* ensure ModalCloseButton is right-aligned */
|
|
13293
|
+
|
|
13294
|
+
/* Dialog.Title creates an h2 element which inherits some margin */
|
|
13295
|
+
h2 {
|
|
13296
|
+
margin: 0;
|
|
13297
|
+
padding-right: ${({ $hideCloseButon }) => $hideCloseButon ? "0" : "var(--wui-space-03)"};
|
|
13298
|
+
}
|
|
13299
|
+
|
|
13300
|
+
button {
|
|
13301
|
+
position: absolute;
|
|
13302
|
+
right: var(--wui-space-03);
|
|
13303
|
+
top: var(--wui-space-03);
|
|
13304
|
+
}
|
|
13305
|
+
`;
|
|
13306
|
+
const Title = styled(Dialog.Title)`
|
|
13307
|
+
font-family: var(--wui-typography-heading-2-family);
|
|
13308
|
+
line-height: var(--wui-typography-heading-2-line-height);
|
|
13309
|
+
font-size: var(--wui-typography-heading-2-size);
|
|
13310
|
+
font-weight: var(--wui-typography-heading-2-weight);
|
|
13311
|
+
overflow-wrap: anywhere;
|
|
13312
|
+
`;
|
|
13313
|
+
const ModalHeader = ({ title, hideTitle, hideCloseButton }) => {
|
|
13314
|
+
return /* @__PURE__ */ jsxs(Header, {
|
|
13315
|
+
$hideCloseButon: hideCloseButton,
|
|
13316
|
+
$hideTitle: hideTitle,
|
|
13317
|
+
children: [hideTitle ? /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx(Title, { children: title }) }) : /* @__PURE__ */ jsx(Title, { children: title }), hideCloseButton ? null : /* @__PURE__ */ jsx(ModalCloseButton, {})]
|
|
13318
|
+
});
|
|
13319
|
+
};
|
|
13320
|
+
//#endregion
|
|
13321
|
+
//#region src/components/Modal/constants.ts
|
|
13322
|
+
const DEFAULT_MODAL_WIDTH = "532px";
|
|
13323
|
+
//#endregion
|
|
13324
|
+
//#region src/components/Modal/ModalContent.tsx
|
|
13325
|
+
const modalEnter = keyframes`
|
|
13326
|
+
from {
|
|
13327
|
+
opacity: 0;
|
|
13328
|
+
transform: translateX(-50%) translateY(calc(var(--wui-modal-translate-y) + 24px));
|
|
13329
|
+
}
|
|
13330
|
+
|
|
13331
|
+
to {
|
|
13332
|
+
opacity: 1;
|
|
13333
|
+
transform: translateX(-50%) translateY(var(--wui-modal-translate-y));
|
|
13334
|
+
}
|
|
13335
|
+
`;
|
|
13336
|
+
const modalExit = keyframes`
|
|
13337
|
+
from {
|
|
13338
|
+
opacity: 1;
|
|
13339
|
+
transform: translateX(-50%) translateY(var(--wui-modal-translate-y));
|
|
13340
|
+
}
|
|
13341
|
+
|
|
13342
|
+
to {
|
|
13343
|
+
opacity: 0;
|
|
13344
|
+
transform: translateX(-50%) translateY(calc(var(--wui-modal-translate-y) + 24px));
|
|
13345
|
+
}
|
|
13346
|
+
`;
|
|
13347
|
+
const positionStyleMap = {
|
|
13348
|
+
centered: css`
|
|
13349
|
+
--wui-modal-screen-offset: var(--wui-space-05);
|
|
13350
|
+
--wui-modal-translate-y: -50%;
|
|
13351
|
+
|
|
13352
|
+
height: auto;
|
|
13353
|
+
max-height: calc(100vh - var(--wui-modal-screen-offset) * 2);
|
|
13354
|
+
top: 50%;
|
|
13355
|
+
left: 50%;
|
|
13356
|
+
transform: translateX(-50%) translateY(var(--wui-modal-translate-y));
|
|
13357
|
+
transform-origin: left center;
|
|
13358
|
+
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
13359
|
+
|
|
13360
|
+
&[data-closed] {
|
|
13361
|
+
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
|
|
13362
|
+
}
|
|
13363
|
+
`,
|
|
13364
|
+
"fixed-top": css`
|
|
13365
|
+
--wui-modal-screen-offset-top: 15vh;
|
|
13366
|
+
--wui-modal-screen-offset-bottom: 5vh;
|
|
13367
|
+
--wui-modal-translate-y: 0%;
|
|
13368
|
+
|
|
13369
|
+
height: auto;
|
|
13370
|
+
max-height: calc(
|
|
13371
|
+
100vh - var(--wui-modal-screen-offset-top) - var(--wui-modal-screen-offset-bottom)
|
|
13372
|
+
);
|
|
13373
|
+
top: var(--wui-modal-screen-offset-top);
|
|
13374
|
+
left: 50%;
|
|
13375
|
+
transform: translateX(-50%) translateY(var(--wui-modal-translate-y));
|
|
13376
|
+
transform-origin: left center;
|
|
13377
|
+
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
13378
|
+
|
|
13379
|
+
&[data-closed] {
|
|
13380
|
+
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
|
|
13381
|
+
}
|
|
13382
|
+
`,
|
|
13383
|
+
"right-side-panel": css`
|
|
13384
|
+
--wui-modal-screen-offset: var(--wui-space-05);
|
|
13385
|
+
|
|
13386
|
+
height: calc(100vh - var(--wui-modal-screen-offset) * 2);
|
|
13387
|
+
top: var(--wui-modal-screen-offset);
|
|
13388
|
+
right: var(--wui-modal-screen-offset);
|
|
13389
|
+
animation: ${keyframes`
|
|
13390
|
+
from {
|
|
13391
|
+
opacity: 0;
|
|
13392
|
+
transform: translateX(100%);
|
|
13393
|
+
}
|
|
13394
|
+
|
|
13395
|
+
to {
|
|
13396
|
+
opacity: 1;
|
|
13397
|
+
transform: translateX(0);
|
|
13398
|
+
}
|
|
13399
|
+
`} var(--wui-motion-duration-05) var(--wui-motion-ease-out);
|
|
13400
|
+
transform-origin: right center;
|
|
13401
|
+
|
|
13402
|
+
&[data-closed] {
|
|
13403
|
+
animation: ${keyframes`
|
|
13404
|
+
from {
|
|
13405
|
+
opacity: 1;
|
|
13406
|
+
transform: translateX(0);
|
|
13407
|
+
}
|
|
13408
|
+
|
|
13409
|
+
to {
|
|
13410
|
+
opacity: 0;
|
|
13411
|
+
transform: translateX(100%);
|
|
13412
|
+
}
|
|
13413
|
+
`} var(--wui-motion-duration-03) var(--wui-motion-ease-in) forwards;
|
|
13414
|
+
}
|
|
13415
|
+
`
|
|
13416
|
+
};
|
|
13417
|
+
const StyledModalContent = styled(Dialog.Popup)`
|
|
13418
|
+
position: fixed;
|
|
13419
|
+
display: flex;
|
|
13420
|
+
flex-direction: column;
|
|
13421
|
+
gap: var(--wui-space-03);
|
|
13422
|
+
top: 0;
|
|
13423
|
+
left: 0;
|
|
13424
|
+
width: 100vw;
|
|
13425
|
+
height: 100vh;
|
|
13426
|
+
z-index: var(--wui-zindex-modal);
|
|
13427
|
+
box-sizing: border-box;
|
|
13428
|
+
padding: var(--wui-space-05) 0;
|
|
13429
|
+
background-color: var(--wui-color-bg-app);
|
|
13430
|
+
|
|
13431
|
+
${mq.smAndUp} {
|
|
13432
|
+
position: fixed;
|
|
13433
|
+
top: unset;
|
|
13434
|
+
left: unset;
|
|
13435
|
+
width: calc(100vw - var(--wui-space-05) * 2);
|
|
13436
|
+
max-width: ${({ $width }) => $width ?? "532px"};
|
|
13437
|
+
border-radius: var(--wui-border-radius-03);
|
|
13438
|
+
animation-duration: var(--wui-motion-duration-03);
|
|
13439
|
+
animation-timing-function: var(--wui-motion-ease-out);
|
|
13440
|
+
will-change: transform, opacity;
|
|
13441
|
+
${({ $positionVariant }) => positionStyleMap[$positionVariant]}
|
|
13442
|
+
}
|
|
13443
|
+
`;
|
|
13444
|
+
const ModalContent = ({ width, positionVariant, initialFocusRef, children, ref, ...props }) => {
|
|
13445
|
+
return /* @__PURE__ */ jsx(StyledModalContent, {
|
|
13446
|
+
ref,
|
|
13447
|
+
$positionVariant: positionVariant,
|
|
13448
|
+
$width: width,
|
|
13449
|
+
...isNotNil(initialFocusRef) ? { initialFocus: initialFocusRef } : {},
|
|
13450
|
+
...props,
|
|
13451
|
+
children
|
|
13452
|
+
});
|
|
13453
|
+
};
|
|
13454
|
+
//#endregion
|
|
13455
|
+
//#region src/components/Modal/ModalOverlay.tsx
|
|
13456
|
+
const backdropShow = keyframes`
|
|
13457
|
+
from {
|
|
13458
|
+
opacity: 0;
|
|
13459
|
+
}
|
|
14095
13460
|
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
`;
|
|
14100
|
-
const MeterLabelContainer = styled.div`
|
|
14101
|
-
display: flex;
|
|
14102
|
-
justify-content: space-between;
|
|
14103
|
-
align-items: baseline;
|
|
14104
|
-
`;
|
|
14105
|
-
const MeterLabel = styled.div`
|
|
14106
|
-
font-family: var(--wui-typography-heading-5-family);
|
|
14107
|
-
line-height: var(--wui-typography-heading-5-line-height);
|
|
14108
|
-
font-size: var(--wui-typography-heading-5-size);
|
|
14109
|
-
font-weight: var(--wui-typography-heading-5-weight);
|
|
14110
|
-
`;
|
|
14111
|
-
const MeterLabelMeta = styled.div`
|
|
14112
|
-
font-family: var(--wui-typography-heading-5-family);
|
|
14113
|
-
line-height: var(--wui-typography-heading-5-line-height);
|
|
14114
|
-
font-size: var(--wui-typography-heading-5-size);
|
|
14115
|
-
font-weight: var(--wui-typography-heading-5-weight);
|
|
14116
|
-
`;
|
|
14117
|
-
const MeterBarContainer = styled.div`
|
|
14118
|
-
position: relative;
|
|
14119
|
-
overflow: hidden;
|
|
14120
|
-
background-color: var(--wui-color-bg-surface-secondary);
|
|
14121
|
-
border-radius: var(--wui-border-radius-rounded);
|
|
14122
|
-
width: 100%;
|
|
14123
|
-
height: var(--meter-height);
|
|
14124
|
-
transform: translateZ(0);
|
|
13461
|
+
to {
|
|
13462
|
+
opacity: 1;
|
|
13463
|
+
}
|
|
14125
13464
|
`;
|
|
14126
|
-
const
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
left: ${({ $offset }) => $offset}%;
|
|
14130
|
-
width: ${({ $width }) => $width}%;
|
|
14131
|
-
height: 100%;
|
|
14132
|
-
background-color: ${({ $color }) => `var(--wui-${$color})`};
|
|
14133
|
-
|
|
14134
|
-
&:first-child {
|
|
14135
|
-
border-top-left-radius: var(--wui-border-radius-rounded);
|
|
14136
|
-
border-bottom-left-radius: var(--wui-border-radius-rounded);
|
|
13465
|
+
const backdropHide = keyframes`
|
|
13466
|
+
from {
|
|
13467
|
+
opacity: 1;
|
|
14137
13468
|
}
|
|
14138
13469
|
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
border-bottom-right-radius: var(--wui-border-radius-rounded);
|
|
13470
|
+
to {
|
|
13471
|
+
opacity: 0;
|
|
14142
13472
|
}
|
|
14143
13473
|
`;
|
|
14144
|
-
const
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
13474
|
+
const ModalOverlay = styled(Dialog.Backdrop)`
|
|
13475
|
+
animation: ${backdropShow} var(--wui-motion-duration-02);
|
|
13476
|
+
background: var(--wui-color-backdrop);
|
|
13477
|
+
inset: 0;
|
|
13478
|
+
position: fixed;
|
|
13479
|
+
z-index: var(--wui-zindex-backdrop);
|
|
13480
|
+
|
|
13481
|
+
&[data-closed] {
|
|
13482
|
+
animation: ${backdropHide} var(--wui-motion-duration-02) forwards;
|
|
13483
|
+
}
|
|
14154
13484
|
`;
|
|
14155
|
-
|
|
13485
|
+
//#endregion
|
|
13486
|
+
//#region src/components/Modal/Modal.tsx
|
|
13487
|
+
const ModalHiddenDescription = styled(Dialog.Description)({ ...visuallyHiddenStyle });
|
|
13488
|
+
const ModalBody = styled.div`
|
|
13489
|
+
flex-direction: column;
|
|
14156
13490
|
display: flex;
|
|
14157
|
-
|
|
14158
|
-
|
|
13491
|
+
flex: 1 0 0;
|
|
13492
|
+
padding: 0 var(--wui-space-05);
|
|
14159
13493
|
`;
|
|
14160
|
-
const
|
|
14161
|
-
|
|
14162
|
-
height:
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
flex-shrink: 0;
|
|
13494
|
+
const ModalScrollArea = styled.div`
|
|
13495
|
+
order: 2;
|
|
13496
|
+
max-height: 90vh;
|
|
13497
|
+
overflow-y: auto;
|
|
13498
|
+
height: 100%;
|
|
14166
13499
|
`;
|
|
14167
|
-
const
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
font-weight: var(--wui-typography-label-3-weight);
|
|
14171
|
-
color: var(--wui-color-text-secondary);
|
|
13500
|
+
const ModalFooter = styled.footer`
|
|
13501
|
+
padding: 0 var(--wui-space-05);
|
|
13502
|
+
order: 3;
|
|
14172
13503
|
`;
|
|
14173
|
-
const nodeToString = (node) => {
|
|
14174
|
-
if (typeof node === "string") return node;
|
|
14175
|
-
if (typeof node === "number") return String(node);
|
|
14176
|
-
if (node == null || typeof node === "boolean") return "";
|
|
14177
|
-
if (Array.isArray(node)) return node.map(nodeToString).join("");
|
|
14178
|
-
if (typeof node === "object" && "props" in node) {
|
|
14179
|
-
const element = node;
|
|
14180
|
-
if (element.props?.children != null) return nodeToString(element.props.children);
|
|
14181
|
-
}
|
|
14182
|
-
return "";
|
|
14183
|
-
};
|
|
14184
13504
|
/**
|
|
14185
|
-
* A
|
|
13505
|
+
* A Modal is a focused UI element that appears atop the main interface, requiring
|
|
13506
|
+
* user interaction or dismissal before returning to the underlying content.
|
|
14186
13507
|
*/
|
|
14187
|
-
const
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
children: [
|
|
14211
|
-
/* @__PURE__ */ jsx(ScreenReaderOnly, {
|
|
14212
|
-
id: descriptionId,
|
|
14213
|
-
text: generateAriaDescription()
|
|
14214
|
-
}),
|
|
14215
|
-
isNotNil(label) || isNotNil(labelMeta) ? /* @__PURE__ */ jsxs(MeterLabelContainer, {
|
|
14216
|
-
id: labelId,
|
|
14217
|
-
children: [isNotNil(label) ? /* @__PURE__ */ jsx(MeterLabel, { children: label }) : null, isNotNil(labelMeta) ? /* @__PURE__ */ jsx(MeterLabelMeta, { children: labelMeta }) : null]
|
|
14218
|
-
}) : null,
|
|
14219
|
-
/* @__PURE__ */ jsx(MeterBarContainer, {
|
|
14220
|
-
"aria-describedby": descriptionId,
|
|
14221
|
-
"aria-label": effectiveAriaLabel,
|
|
14222
|
-
"aria-labelledby": isNotNil(label) || isNotNil(labelMeta) ? labelId : void 0,
|
|
14223
|
-
"aria-valuemax": max,
|
|
14224
|
-
"aria-valuemin": 0,
|
|
14225
|
-
"aria-valuenow": totalValue,
|
|
14226
|
-
role: "meter",
|
|
14227
|
-
children: segmentsWithOffsets.map((segment) => /* @__PURE__ */ jsx(MeterSegmentBar, {
|
|
14228
|
-
$color: segment.color,
|
|
14229
|
-
$offset: segment.offset,
|
|
14230
|
-
$width: segment.widthPercent,
|
|
14231
|
-
"aria-hidden": "true"
|
|
14232
|
-
}, `${segment.color}-${segment.value}-${segment.offset}`))
|
|
14233
|
-
}),
|
|
14234
|
-
isNotNil(description) ? /* @__PURE__ */ jsx(MeterDescription, { children: description }) : null,
|
|
14235
|
-
!hideKey && keySegments.length > 0 ? /* @__PURE__ */ jsx(MeterKey, {
|
|
14236
|
-
"aria-label": "Meter legend",
|
|
14237
|
-
role: "list",
|
|
14238
|
-
children: keySegments.map((segment) => /* @__PURE__ */ jsxs(MeterKeyItem, {
|
|
14239
|
-
role: "listitem",
|
|
14240
|
-
children: [/* @__PURE__ */ jsx(MeterKeyColorIndicator, {
|
|
14241
|
-
$color: segment.color,
|
|
14242
|
-
"aria-hidden": "true"
|
|
14243
|
-
}), /* @__PURE__ */ jsx(MeterKeyLabel, { children: segment.label })]
|
|
14244
|
-
}, `${segment.color}-${segment.value}-${segment.offset}-${nodeToString(segment.label)}`))
|
|
14245
|
-
}) : null
|
|
14246
|
-
]
|
|
13508
|
+
const Modal = ({ children, footer, hideCloseButton = false, hideTitle = false, initialFocusRef, isOpen, onRequestClose, positionVariant = "centered", title, width = DEFAULT_MODAL_WIDTH, ref, ...props }) => {
|
|
13509
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
13510
|
+
onOpenChange: (open) => {
|
|
13511
|
+
if (!open && isNotNil(onRequestClose)) onRequestClose();
|
|
13512
|
+
},
|
|
13513
|
+
open: isOpen,
|
|
13514
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
|
|
13515
|
+
ref,
|
|
13516
|
+
initialFocusRef,
|
|
13517
|
+
positionVariant,
|
|
13518
|
+
width,
|
|
13519
|
+
...props,
|
|
13520
|
+
children: [
|
|
13521
|
+
/* @__PURE__ */ jsx(ModalScrollArea, { children: /* @__PURE__ */ jsx(ModalBody, { children }) }),
|
|
13522
|
+
isNotNil(footer) ? /* @__PURE__ */ jsx(ModalFooter, { children: footer }) : null,
|
|
13523
|
+
hideCloseButton && hideTitle ? null : /* @__PURE__ */ jsx(ModalHeader, {
|
|
13524
|
+
hideCloseButton,
|
|
13525
|
+
hideTitle,
|
|
13526
|
+
title
|
|
13527
|
+
}),
|
|
13528
|
+
/* @__PURE__ */ jsx(ModalHiddenDescription, {})
|
|
13529
|
+
]
|
|
13530
|
+
})] })
|
|
14247
13531
|
});
|
|
14248
13532
|
};
|
|
14249
|
-
Meter.displayName = "Meter_UI";
|
|
14250
13533
|
//#endregion
|
|
14251
|
-
//#region src/components/Modal/
|
|
14252
|
-
const
|
|
14253
|
-
return /* @__PURE__ */ jsx(
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
13534
|
+
//#region src/components/Modal/ModalCallouts.tsx
|
|
13535
|
+
const ModalCallouts = ({ children }) => {
|
|
13536
|
+
return /* @__PURE__ */ jsx(Stack, {
|
|
13537
|
+
direction: "horizontal",
|
|
13538
|
+
gap: "space-08",
|
|
13539
|
+
children
|
|
13540
|
+
});
|
|
13541
|
+
};
|
|
13542
|
+
ModalCallouts.displayName = "ModalCallouts_UI";
|
|
13543
|
+
const ModalCallout = ({ title, image, children }) => {
|
|
13544
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
13545
|
+
direction: "vertical",
|
|
13546
|
+
children: [
|
|
13547
|
+
image,
|
|
13548
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
13549
|
+
variant: "heading4",
|
|
13550
|
+
children: title
|
|
13551
|
+
}),
|
|
13552
|
+
children
|
|
13553
|
+
]
|
|
13554
|
+
});
|
|
14260
13555
|
};
|
|
13556
|
+
ModalCallout.displayName = "ModalCallout_UI";
|
|
14261
13557
|
//#endregion
|
|
14262
|
-
//#region src/
|
|
14263
|
-
const
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
13558
|
+
//#region src/private/helpers/getControls/getControlProps.tsx
|
|
13559
|
+
const getControlProps = (isOpen, onOpenChange) => {
|
|
13560
|
+
return isNotNil(onOpenChange) && isNotNil(isOpen) ? {
|
|
13561
|
+
open: isOpen,
|
|
13562
|
+
onOpenChange
|
|
13563
|
+
} : {};
|
|
13564
|
+
};
|
|
13565
|
+
//#endregion
|
|
13566
|
+
//#region src/components/Popover/PopoverArrow.tsx
|
|
13567
|
+
const StyledArrowSvg = styled.svg`
|
|
13568
|
+
pointer-events: none;
|
|
14270
13569
|
|
|
14271
|
-
/*
|
|
14272
|
-
|
|
14273
|
-
|
|
14274
|
-
padding-right: ${({ $hideCloseButon }) => $hideCloseButon ? "0" : "var(--wui-space-03)"};
|
|
13570
|
+
/* override inline positioning and rotate the arrow so the circle sits near the trigger and the stalk extends down toward the popup. */
|
|
13571
|
+
&[data-side='top'] {
|
|
13572
|
+
top: 100% !important;
|
|
14275
13573
|
}
|
|
14276
13574
|
|
|
14277
|
-
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
13575
|
+
&[data-side='bottom'] {
|
|
13576
|
+
top: 0 !important;
|
|
13577
|
+
transform: rotate(180deg);
|
|
13578
|
+
transform-origin: center 0;
|
|
14281
13579
|
}
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
overflow-wrap: anywhere;
|
|
14289
|
-
`;
|
|
14290
|
-
const ModalHeader = ({ title, hideTitle, hideCloseButton }) => {
|
|
14291
|
-
return /* @__PURE__ */ jsxs(Header, {
|
|
14292
|
-
$hideCloseButon: hideCloseButton,
|
|
14293
|
-
$hideTitle: hideTitle,
|
|
14294
|
-
children: [hideTitle ? /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx(Title, { children: title }) }) : /* @__PURE__ */ jsx(Title, { children: title }), hideCloseButton ? null : /* @__PURE__ */ jsx(ModalCloseButton, {})]
|
|
14295
|
-
});
|
|
14296
|
-
};
|
|
14297
|
-
//#endregion
|
|
14298
|
-
//#region src/components/Modal/constants.ts
|
|
14299
|
-
const DEFAULT_MODAL_WIDTH = "532px";
|
|
14300
|
-
//#endregion
|
|
14301
|
-
//#region src/components/Modal/ModalContent.tsx
|
|
14302
|
-
const modalEnter = keyframes`
|
|
14303
|
-
from {
|
|
14304
|
-
opacity: 0;
|
|
14305
|
-
transform: translateX(-50%) translateY(calc(var(--wui-modal-translate-y) + 24px));
|
|
13580
|
+
|
|
13581
|
+
&[data-side='left'] {
|
|
13582
|
+
right: 0;
|
|
13583
|
+
left: auto;
|
|
13584
|
+
transform: translateX(52px) rotate(-90deg);
|
|
13585
|
+
transform-origin: center center;
|
|
14306
13586
|
}
|
|
14307
13587
|
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
13588
|
+
&[data-side='right'] {
|
|
13589
|
+
left: 0;
|
|
13590
|
+
right: auto;
|
|
13591
|
+
transform: translateX(-52px) rotate(90deg);
|
|
13592
|
+
transform-origin: center center;
|
|
14311
13593
|
}
|
|
14312
13594
|
`;
|
|
14313
|
-
const
|
|
14314
|
-
|
|
14315
|
-
|
|
14316
|
-
|
|
13595
|
+
const StyledPath = styled.path`
|
|
13596
|
+
fill: var(--wui-color-border-secondary);
|
|
13597
|
+
`;
|
|
13598
|
+
const circleAnimation = keyframes`
|
|
13599
|
+
0% {
|
|
13600
|
+
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
14317
13601
|
}
|
|
14318
|
-
|
|
14319
|
-
to {
|
|
13602
|
+
100% {
|
|
14320
13603
|
opacity: 0;
|
|
14321
|
-
transform: translateX(-50%) translateY(calc(var(--wui-modal-translate-y) + 24px));
|
|
14322
13604
|
}
|
|
14323
13605
|
`;
|
|
14324
|
-
const
|
|
14325
|
-
|
|
14326
|
-
|
|
14327
|
-
|
|
13606
|
+
const StyledCircle = styled.circle`
|
|
13607
|
+
stroke: var(--wui-color-border-active);
|
|
13608
|
+
animation-duration: 2s;
|
|
13609
|
+
animation-iteration-count: infinite;
|
|
13610
|
+
animation-direction: alternate;
|
|
13611
|
+
animation-timing-function: ease-in-out;
|
|
14328
13612
|
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
top: 50%;
|
|
14332
|
-
left: 50%;
|
|
14333
|
-
transform: translateX(-50%) translateY(var(--wui-modal-translate-y));
|
|
14334
|
-
transform-origin: left center;
|
|
14335
|
-
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
13613
|
+
&[data-wui-popover-arrow-inner-circle] {
|
|
13614
|
+
--wui-popover-arrow-circle-starting-opacity: 0.36;
|
|
14336
13615
|
|
|
14337
|
-
|
|
14338
|
-
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
|
|
13616
|
+
opacity: var(--wui-popover-arrow-circle-starting-opacity);
|
|
14339
13617
|
}
|
|
14340
|
-
`,
|
|
14341
|
-
"fixed-top": css`
|
|
14342
|
-
--wui-modal-screen-offset-top: 15vh;
|
|
14343
|
-
--wui-modal-screen-offset-bottom: 5vh;
|
|
14344
|
-
--wui-modal-translate-y: 0%;
|
|
14345
|
-
|
|
14346
|
-
height: auto;
|
|
14347
|
-
max-height: calc(
|
|
14348
|
-
100vh - var(--wui-modal-screen-offset-top) - var(--wui-modal-screen-offset-bottom)
|
|
14349
|
-
);
|
|
14350
|
-
top: var(--wui-modal-screen-offset-top);
|
|
14351
|
-
left: 50%;
|
|
14352
|
-
transform: translateX(-50%) translateY(var(--wui-modal-translate-y));
|
|
14353
|
-
transform-origin: left center;
|
|
14354
|
-
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
14355
13618
|
|
|
14356
|
-
&[data-
|
|
14357
|
-
|
|
14358
|
-
}
|
|
14359
|
-
`,
|
|
14360
|
-
"right-side-panel": css`
|
|
14361
|
-
--wui-modal-screen-offset: var(--wui-space-05);
|
|
13619
|
+
&[data-wui-popover-arrow-outer-circle] {
|
|
13620
|
+
--wui-popover-arrow-circle-starting-opacity: 0.2;
|
|
14362
13621
|
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
right: var(--wui-modal-screen-offset);
|
|
14366
|
-
animation: ${keyframes`
|
|
14367
|
-
from {
|
|
14368
|
-
opacity: 0;
|
|
14369
|
-
transform: translateX(100%);
|
|
13622
|
+
animation-direction: alternate-reverse;
|
|
13623
|
+
opacity: 0.11;
|
|
14370
13624
|
}
|
|
14371
13625
|
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
13626
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
13627
|
+
${({ $isAnimated }) => $isAnimated && css`
|
|
13628
|
+
animation-name: ${circleAnimation};
|
|
13629
|
+
`}
|
|
14375
13630
|
}
|
|
14376
|
-
|
|
14377
|
-
|
|
13631
|
+
`;
|
|
13632
|
+
const PopoverArrow = ({ isAnimated }) => {
|
|
13633
|
+
return /* @__PURE__ */ jsx(Popover$1.Arrow, { render: /* @__PURE__ */ jsxs(StyledArrowSvg, {
|
|
13634
|
+
fill: "none",
|
|
13635
|
+
height: "56",
|
|
13636
|
+
viewBox: "0 0 48 56",
|
|
13637
|
+
width: "48",
|
|
13638
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13639
|
+
children: [
|
|
13640
|
+
/* @__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" }),
|
|
13641
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
13642
|
+
$isAnimated: isAnimated,
|
|
13643
|
+
cx: "24",
|
|
13644
|
+
cy: "32",
|
|
13645
|
+
"data-wui-popover-arrow-inner-circle": true,
|
|
13646
|
+
r: "10",
|
|
13647
|
+
strokeWidth: "4"
|
|
13648
|
+
}),
|
|
13649
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
13650
|
+
$isAnimated: isAnimated,
|
|
13651
|
+
cx: "24",
|
|
13652
|
+
cy: "32",
|
|
13653
|
+
"data-wui-popover-arrow-outer-circle": true,
|
|
13654
|
+
r: "20",
|
|
13655
|
+
strokeWidth: "8"
|
|
13656
|
+
})
|
|
13657
|
+
]
|
|
13658
|
+
}) });
|
|
13659
|
+
};
|
|
13660
|
+
PopoverArrow.displayName = "PopoverArrow_UI";
|
|
13661
|
+
//#endregion
|
|
13662
|
+
//#region src/components/Popover/Popover.tsx
|
|
13663
|
+
const StyledPopup$2 = styled(Popover$1.Popup)`
|
|
13664
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
13665
|
+
${({ $unstyled }) => !$unstyled && css`
|
|
13666
|
+
border-radius: var(--wui-border-radius-02);
|
|
13667
|
+
padding: var(--wui-space-04);
|
|
13668
|
+
max-width: var(--wui-popover-max-width, 320px);
|
|
13669
|
+
max-height: var(--wui-popover-max-height, auto);
|
|
13670
|
+
background-color: var(--wui-color-bg-surface);
|
|
13671
|
+
box-shadow: var(--wui-elevation-01);
|
|
13672
|
+
border: 1px solid var(--wui-color-border);
|
|
13673
|
+
overflow: auto;
|
|
13674
|
+
`}
|
|
14378
13675
|
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
opacity: 1;
|
|
14383
|
-
transform: translateX(0);
|
|
14384
|
-
}
|
|
13676
|
+
${({ $withArrow }) => $withArrow && css`
|
|
13677
|
+
overflow: visible;
|
|
13678
|
+
`}
|
|
14385
13679
|
|
|
14386
|
-
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
`} var(--wui-motion-duration-03) var(--wui-motion-ease-in) forwards;
|
|
13680
|
+
[data-wui-popover-close] {
|
|
13681
|
+
position: absolute;
|
|
13682
|
+
top: var(--wui-space-02);
|
|
13683
|
+
right: var(--wui-space-02);
|
|
14391
13684
|
}
|
|
14392
|
-
|
|
13685
|
+
`;
|
|
13686
|
+
/**
|
|
13687
|
+
* Displays rich content in a portal, triggered by a button.
|
|
13688
|
+
*
|
|
13689
|
+
* For more control — custom anchor, no injected close button, etc. — compose
|
|
13690
|
+
* the primitives directly: `PopoverRoot`, `PopoverTrigger`, `PopoverAnchor`,
|
|
13691
|
+
* `PopoverPortal`, `PopoverContent`, `PopoverClose`.
|
|
13692
|
+
*/
|
|
13693
|
+
const Popover = ({ children, trigger, isOpen, hideCloseButton = false, maxWidth, maxHeight, onOpenChange, unstyled = false, withArrow = false, isAnimated = false, colorScheme = "inherit", style, side, align, nativeButton = true, ...props }) => {
|
|
13694
|
+
const sideOffset = withArrow ? 32 : 8;
|
|
13695
|
+
const mergedStyle = {
|
|
13696
|
+
"--wui-popover-max-width": maxWidth,
|
|
13697
|
+
"--wui-popover-max-height": maxHeight,
|
|
13698
|
+
...style
|
|
13699
|
+
};
|
|
13700
|
+
return /* @__PURE__ */ jsxs(Popover$1.Root, {
|
|
13701
|
+
...getControlProps(isOpen, onOpenChange),
|
|
13702
|
+
children: [/* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
13703
|
+
nativeButton,
|
|
13704
|
+
render: trigger
|
|
13705
|
+
}), /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
13706
|
+
align,
|
|
13707
|
+
collisionAvoidance: {
|
|
13708
|
+
side: "flip",
|
|
13709
|
+
align: "shift",
|
|
13710
|
+
fallbackAxisSide: "none"
|
|
13711
|
+
},
|
|
13712
|
+
side,
|
|
13713
|
+
sideOffset,
|
|
13714
|
+
style: { zIndex: "var(--wui-zindex-popover)" },
|
|
13715
|
+
children: /* @__PURE__ */ jsxs(StyledPopup$2, {
|
|
13716
|
+
$colorScheme: colorScheme,
|
|
13717
|
+
...props,
|
|
13718
|
+
$unstyled: unstyled,
|
|
13719
|
+
$withArrow: withArrow,
|
|
13720
|
+
role: "dialog",
|
|
13721
|
+
style: mergedStyle,
|
|
13722
|
+
children: [
|
|
13723
|
+
!hideCloseButton && /* @__PURE__ */ jsx(Popover$1.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
13724
|
+
"data-wui-popover-close": true,
|
|
13725
|
+
label: "Close",
|
|
13726
|
+
variant: "ghost",
|
|
13727
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
13728
|
+
}) }),
|
|
13729
|
+
withArrow ? /* @__PURE__ */ jsx(PopoverArrow, { isAnimated }) : null,
|
|
13730
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
13731
|
+
]
|
|
13732
|
+
})
|
|
13733
|
+
}) })]
|
|
13734
|
+
});
|
|
14393
13735
|
};
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
animation-timing-function: var(--wui-motion-ease-out);
|
|
14417
|
-
will-change: transform, opacity;
|
|
14418
|
-
${({ $positionVariant }) => positionStyleMap[$positionVariant]}
|
|
14419
|
-
}
|
|
14420
|
-
`;
|
|
14421
|
-
const ModalContent = ({ width, positionVariant, initialFocusRef, children, ref, ...props }) => {
|
|
14422
|
-
return /* @__PURE__ */ jsx(StyledModalContent, {
|
|
14423
|
-
ref,
|
|
14424
|
-
$positionVariant: positionVariant,
|
|
14425
|
-
$width: width,
|
|
14426
|
-
...isNotNil(initialFocusRef) ? { initialFocus: initialFocusRef } : {},
|
|
14427
|
-
...props,
|
|
13736
|
+
Popover.displayName = "Popover_UI";
|
|
13737
|
+
//#endregion
|
|
13738
|
+
//#region src/components/Popover/PopoverAnchorContext.tsx
|
|
13739
|
+
const PopoverAnchorContext = createContext(null);
|
|
13740
|
+
const PopoverAnchorProvider = PopoverAnchorContext;
|
|
13741
|
+
const usePopoverAnchor = () => useContext(PopoverAnchorContext);
|
|
13742
|
+
const useCreatePopoverAnchorRef = () => useRef(null);
|
|
13743
|
+
//#endregion
|
|
13744
|
+
//#region src/components/Popover/PopoverAnchor.tsx
|
|
13745
|
+
/**
|
|
13746
|
+
* Positions the popover relative to an element other than the trigger. Useful
|
|
13747
|
+
* when the element the user interacts with (e.g. a text input) is separate
|
|
13748
|
+
* from what the popover attaches to.
|
|
13749
|
+
*
|
|
13750
|
+
* Wrap the anchor element and nest `PopoverTrigger` inside it.
|
|
13751
|
+
*/
|
|
13752
|
+
const PopoverAnchor = ({ children }) => {
|
|
13753
|
+
const sharedRef = usePopoverAnchor();
|
|
13754
|
+
return /* @__PURE__ */ jsx("div", {
|
|
13755
|
+
ref: useCallback((node) => {
|
|
13756
|
+
if (sharedRef) sharedRef.current = node;
|
|
13757
|
+
}, [sharedRef]),
|
|
14428
13758
|
children
|
|
14429
13759
|
});
|
|
14430
13760
|
};
|
|
13761
|
+
PopoverAnchor.displayName = "PopoverAnchor_UI";
|
|
14431
13762
|
//#endregion
|
|
14432
|
-
//#region src/components/
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
13763
|
+
//#region src/components/Popover/PopoverClose.tsx
|
|
13764
|
+
/**
|
|
13765
|
+
* An element that closes the popover when activated. Defaults to a `<button>`;
|
|
13766
|
+
* pass `render` to merge the close behavior onto a single child element. For
|
|
13767
|
+
* a pre-styled icon close button, use `PopoverCloseButton`.
|
|
13768
|
+
*/
|
|
13769
|
+
const PopoverClose = ({ ref, ...props }) => /* @__PURE__ */ jsx(Popover$1.Close, {
|
|
13770
|
+
ref,
|
|
13771
|
+
...props
|
|
13772
|
+
});
|
|
13773
|
+
//#endregion
|
|
13774
|
+
//#region src/components/Popover/PopoverCloseButton.tsx
|
|
13775
|
+
/**
|
|
13776
|
+
* A pre-styled close button intended to be placed inside a `PopoverContent`.
|
|
13777
|
+
* For a custom close control, use `PopoverClose` directly.
|
|
13778
|
+
*/
|
|
13779
|
+
const PopoverCloseButton = ({ label = "Close" }) => /* @__PURE__ */ jsx(PopoverClose, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
13780
|
+
"data-wui-popover-close": true,
|
|
13781
|
+
label,
|
|
13782
|
+
variant: "ghost",
|
|
13783
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
13784
|
+
}) });
|
|
13785
|
+
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
13786
|
+
//#endregion
|
|
13787
|
+
//#region src/components/Popover/PopoverContent.tsx
|
|
13788
|
+
const StyledPopup$1 = styled(Popover$1.Popup)`
|
|
13789
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
13790
|
+
${({ $unstyled }) => !$unstyled && css`
|
|
13791
|
+
border-radius: var(--wui-border-radius-02);
|
|
13792
|
+
padding: var(--wui-space-04);
|
|
13793
|
+
max-width: var(--wui-popover-max-width);
|
|
13794
|
+
max-height: var(--wui-popover-max-height);
|
|
13795
|
+
background-color: var(--wui-color-bg-surface);
|
|
13796
|
+
box-shadow: var(--wui-elevation-01);
|
|
13797
|
+
border: 1px solid var(--wui-color-border);
|
|
13798
|
+
overflow: auto;
|
|
13799
|
+
`}
|
|
14457
13800
|
|
|
14458
|
-
|
|
14459
|
-
|
|
13801
|
+
[data-wui-popover-close] {
|
|
13802
|
+
position: absolute;
|
|
13803
|
+
top: var(--wui-space-02);
|
|
13804
|
+
right: var(--wui-space-02);
|
|
14460
13805
|
}
|
|
14461
13806
|
`;
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
const
|
|
14465
|
-
const ModalBody = styled.div`
|
|
14466
|
-
flex-direction: column;
|
|
14467
|
-
display: flex;
|
|
14468
|
-
flex: 1 0 0;
|
|
14469
|
-
padding: 0 var(--wui-space-05);
|
|
14470
|
-
`;
|
|
14471
|
-
const ModalScrollArea = styled.div`
|
|
14472
|
-
order: 2;
|
|
14473
|
-
max-height: 90vh;
|
|
14474
|
-
overflow-y: auto;
|
|
14475
|
-
height: 100%;
|
|
14476
|
-
`;
|
|
14477
|
-
const ModalFooter = styled.footer`
|
|
14478
|
-
padding: 0 var(--wui-space-05);
|
|
14479
|
-
order: 3;
|
|
14480
|
-
`;
|
|
13807
|
+
const DEFAULT_SIDE_OFFSET = 8;
|
|
13808
|
+
const DEFAULT_MAX_WIDTH = "320px";
|
|
13809
|
+
const DEFAULT_MAX_HEIGHT = "auto";
|
|
14481
13810
|
/**
|
|
14482
|
-
*
|
|
14483
|
-
*
|
|
13811
|
+
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
13812
|
+
* in a `PopoverPortal`). Wraps a `Positioner` and `Popup` internally.
|
|
14484
13813
|
*/
|
|
14485
|
-
const
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
13814
|
+
const PopoverContent = ({ colorScheme = "inherit", unstyled = false, maxWidth = DEFAULT_MAX_WIDTH, maxHeight = DEFAULT_MAX_HEIGHT, sideOffset = DEFAULT_SIDE_OFFSET, side, align, style, role = "dialog", children, ref, ...props }) => {
|
|
13815
|
+
const sharedAnchorRef = usePopoverAnchor();
|
|
13816
|
+
const hasAnchor = sharedAnchorRef?.current != null;
|
|
13817
|
+
const mergedStyle = {
|
|
13818
|
+
"--wui-popover-max-width": maxWidth,
|
|
13819
|
+
"--wui-popover-max-height": maxHeight,
|
|
13820
|
+
...style
|
|
13821
|
+
};
|
|
13822
|
+
return /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
13823
|
+
align,
|
|
13824
|
+
collisionAvoidance: {
|
|
13825
|
+
side: "flip",
|
|
13826
|
+
align: "shift",
|
|
13827
|
+
fallbackAxisSide: "none"
|
|
14489
13828
|
},
|
|
14490
|
-
|
|
14491
|
-
|
|
13829
|
+
side,
|
|
13830
|
+
sideOffset,
|
|
13831
|
+
style: { zIndex: "var(--wui-zindex-popover)" },
|
|
13832
|
+
...hasAnchor ? { anchor: sharedAnchorRef } : {},
|
|
13833
|
+
children: /* @__PURE__ */ jsx(StyledPopup$1, {
|
|
14492
13834
|
ref,
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
13835
|
+
$colorScheme: colorScheme,
|
|
13836
|
+
$unstyled: unstyled,
|
|
13837
|
+
role,
|
|
13838
|
+
style: mergedStyle,
|
|
14496
13839
|
...props,
|
|
14497
|
-
children
|
|
14498
|
-
|
|
14499
|
-
isNotNil(footer) ? /* @__PURE__ */ jsx(ModalFooter, { children: footer }) : null,
|
|
14500
|
-
hideCloseButton && hideTitle ? null : /* @__PURE__ */ jsx(ModalHeader, {
|
|
14501
|
-
hideCloseButton,
|
|
14502
|
-
hideTitle,
|
|
14503
|
-
title
|
|
14504
|
-
}),
|
|
14505
|
-
/* @__PURE__ */ jsx(ModalHiddenDescription, {})
|
|
14506
|
-
]
|
|
14507
|
-
})] })
|
|
13840
|
+
children
|
|
13841
|
+
})
|
|
14508
13842
|
});
|
|
14509
13843
|
};
|
|
14510
13844
|
//#endregion
|
|
14511
|
-
//#region src/components/
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
13845
|
+
//#region src/components/Popover/PopoverPortal.tsx
|
|
13846
|
+
/**
|
|
13847
|
+
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
13848
|
+
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
13849
|
+
*/
|
|
13850
|
+
const PopoverPortal = ({ children }) => /* @__PURE__ */ jsx(Popover$1.Portal, { children });
|
|
13851
|
+
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
13852
|
+
//#endregion
|
|
13853
|
+
//#region src/components/Popover/PopoverRoot.tsx
|
|
13854
|
+
/**
|
|
13855
|
+
* The root of a composable popover. Wrap `PopoverTrigger` (or `PopoverAnchor`)
|
|
13856
|
+
* and `PopoverContent` inside it.
|
|
13857
|
+
*
|
|
13858
|
+
* For the common "button opens a panel" case, prefer the bundled `Popover`.
|
|
13859
|
+
*/
|
|
13860
|
+
const PopoverRoot = ({ isOpen, onOpenChange, children }) => {
|
|
13861
|
+
const anchorRef = useCreatePopoverAnchorRef();
|
|
13862
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
13863
|
+
...getControlProps(isOpen, onOpenChange),
|
|
13864
|
+
children: /* @__PURE__ */ jsx(PopoverAnchorProvider, {
|
|
13865
|
+
value: anchorRef,
|
|
14529
13866
|
children
|
|
14530
|
-
|
|
13867
|
+
})
|
|
14531
13868
|
});
|
|
14532
13869
|
};
|
|
14533
|
-
|
|
13870
|
+
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
13871
|
+
//#endregion
|
|
13872
|
+
//#region src/components/Popover/PopoverTrigger.tsx
|
|
13873
|
+
/**
|
|
13874
|
+
* The button that toggles the popover open and closed. By default it renders a
|
|
13875
|
+
* `<button>` wrapping its children; pass `render` to merge the trigger
|
|
13876
|
+
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
13877
|
+
*/
|
|
13878
|
+
const PopoverTrigger = ({ nativeButton = true, ref, ...props }) => /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
13879
|
+
ref,
|
|
13880
|
+
nativeButton,
|
|
13881
|
+
...props
|
|
13882
|
+
});
|
|
14534
13883
|
//#endregion
|
|
14535
13884
|
//#region src/components/ProgressBar/ProgressBar.tsx
|
|
14536
13885
|
const ProgressBarWrapper = styled.div`
|
|
@@ -16603,6 +15952,6 @@ const WistiaLogo = ({ description, height = 100, hoverColor, href, iconOnly = fa
|
|
|
16603
15952
|
};
|
|
16604
15953
|
WistiaLogo.displayName = "WistiaLogo_UI";
|
|
16605
15954
|
//#endregion
|
|
16606
|
-
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,
|
|
15955
|
+
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, InputDuration, 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, Sidebar, SidebarButton, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarSearchInput, SidebarTitle, 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, buildTimeDuration, calculateContrast, coerceToBoolean, colorSchemeOptions, copyToClipboard, dateOnlyISOString, dateOnlyString, dateOnlyStringForSentence, dateOnlyStringNumeric, dateTime, dateTimeRounded, dateTimeString, dateTimeStringForSentence, dateTimeToDate, dateTimeToISO, dateToDateTime, dateUTCOffset, dayOfWeekString, getBackgroundGradient, getSemiRandomBackgroundGradient, iconSizeMap, isKeyboardKey, isUrl, mediaDurationString, mergeRefs, millisecondsToDurationISOString, monthDayStringNumeric, mq, parseDateString, sessionDurationString, stripExtension, timeAgoString, timeOnlyString, useActiveMq, useAriaLive, useBoolean, useClipboard, useElementObserver, useFilePicker, useFocusTrap, useForceUpdate, useFormState, useImperativeFilePicker, useIsHovered, useKey, useKeyPress, useLocalStorage, useLockBodyScroll, useMq, useOnClickOutside, usePreviousValue, useToast, useWindowSize, validateWithYup };
|
|
16607
15956
|
|
|
16608
15957
|
//# sourceMappingURL=index.js.map
|