@wistia/ui 0.18.10-beta.6184f9f6.d0d0aad → 0.18.10-beta.61e9f9ba.0b7ff11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +88 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.mjs +127 -96
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.18.10-beta.
|
|
3
|
+
* @license @wistia/ui v0.18.10-beta.61e9f9ba.0b7ff11
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -15146,8 +15146,20 @@ var import_react73 = require("react");
|
|
|
15146
15146
|
var import_styled_components86 = require("styled-components");
|
|
15147
15147
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
15148
15148
|
var import_jsx_runtime288 = require("react/jsx-runtime");
|
|
15149
|
+
var inlineErrorStyles = import_styled_components86.css`
|
|
15150
|
+
grid-template-rows: 1fr auto;
|
|
15151
|
+
grid-template-areas: 'label-description input' '. error';
|
|
15152
|
+
`;
|
|
15153
|
+
var inlineBaseGridAreaStyles = import_styled_components86.css`
|
|
15154
|
+
grid-template-rows: 1fr;
|
|
15155
|
+
grid-template-areas: 'label-description input';
|
|
15156
|
+
`;
|
|
15157
|
+
var blockGridErrorStyles = import_styled_components86.css`
|
|
15158
|
+
grid-template-rows: auto 1fr auto;
|
|
15159
|
+
grid-template-areas: 'label-description' 'input' 'error';
|
|
15160
|
+
`;
|
|
15149
15161
|
var StyledFormField = import_styled_components86.styled.div`
|
|
15150
|
-
--form-field-spacing: var(--wui-space-
|
|
15162
|
+
--form-field-spacing: var(--wui-space-02);
|
|
15151
15163
|
--form-field-spacing-inline: var(--wui-space-02);
|
|
15152
15164
|
--form-field-error-color: var(--wui-color-text-secondary-error);
|
|
15153
15165
|
|
|
@@ -15161,21 +15173,28 @@ var StyledFormField = import_styled_components86.styled.div`
|
|
|
15161
15173
|
&[data-label-position='inline-compact'] {
|
|
15162
15174
|
gap: var(--form-field-spacing-inline);
|
|
15163
15175
|
grid-template-columns: auto 1fr;
|
|
15164
|
-
|
|
15176
|
+
${inlineBaseGridAreaStyles}
|
|
15177
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15165
15178
|
}
|
|
15166
15179
|
|
|
15167
15180
|
&[data-label-position='inline'] {
|
|
15168
15181
|
gap: var(--form-field-spacing-inline);
|
|
15169
15182
|
grid-template-columns: minmax(auto, 1fr) 1fr;
|
|
15170
|
-
|
|
15183
|
+
${inlineBaseGridAreaStyles}
|
|
15184
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15171
15185
|
}
|
|
15172
15186
|
|
|
15173
15187
|
&[data-label-position='block'] {
|
|
15174
15188
|
gap: var(--form-field-spacing);
|
|
15175
15189
|
grid-template-columns: 1fr;
|
|
15176
|
-
grid-template-rows: 1fr;
|
|
15190
|
+
grid-template-rows: auto 1fr;
|
|
15191
|
+
grid-template-areas: 'label-description' 'input';
|
|
15192
|
+
${({ $hasError }) => $hasError && blockGridErrorStyles}
|
|
15177
15193
|
}
|
|
15178
15194
|
`;
|
|
15195
|
+
var ErrorText = (0, import_styled_components86.styled)(Text)`
|
|
15196
|
+
grid-area: error;
|
|
15197
|
+
`;
|
|
15179
15198
|
var StyledErrorList = import_styled_components86.styled.ul`
|
|
15180
15199
|
margin: 0;
|
|
15181
15200
|
padding: 0;
|
|
@@ -15183,13 +15202,14 @@ var StyledErrorList = import_styled_components86.styled.ul`
|
|
|
15183
15202
|
display: flex;
|
|
15184
15203
|
flex-direction: column;
|
|
15185
15204
|
gap: var(--wui-space-01);
|
|
15205
|
+
grid-area: error;
|
|
15186
15206
|
`;
|
|
15187
15207
|
var ErrorMessages = ({ errors, id }) => {
|
|
15188
15208
|
const isErrorArray = (0, import_type_guards49.isArray)(errors);
|
|
15189
15209
|
const isMultipleErrors = isErrorArray && errors.length > 1;
|
|
15190
15210
|
if (!isErrorArray) {
|
|
15191
15211
|
return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
15192
|
-
|
|
15212
|
+
ErrorText,
|
|
15193
15213
|
{
|
|
15194
15214
|
colorScheme: "error",
|
|
15195
15215
|
id,
|
|
@@ -15202,7 +15222,7 @@ var ErrorMessages = ({ errors, id }) => {
|
|
|
15202
15222
|
}
|
|
15203
15223
|
if (!isMultipleErrors) {
|
|
15204
15224
|
return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
15205
|
-
|
|
15225
|
+
ErrorText,
|
|
15206
15226
|
{
|
|
15207
15227
|
colorScheme: "error",
|
|
15208
15228
|
id,
|
|
@@ -15247,12 +15267,16 @@ var FormField = ({
|
|
|
15247
15267
|
const descriptionId = `${computedId}-description`;
|
|
15248
15268
|
const errorId = `${computedId}-error`;
|
|
15249
15269
|
const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
|
|
15270
|
+
const hasDescription = (0, import_type_guards49.isNotNil)(description);
|
|
15271
|
+
const hasError = (0, import_type_guards49.isNotNil)(computedError);
|
|
15272
|
+
const shouldRenderLabelDescriptionWrapper = !isIntegratedLabel || hasDescription;
|
|
15250
15273
|
let childProps = {
|
|
15251
15274
|
name,
|
|
15252
15275
|
id: computedId,
|
|
15253
15276
|
label: isIntegratedLabel ? label : void 0,
|
|
15254
15277
|
"aria-describedby": ariaDescribedby,
|
|
15255
|
-
"aria-invalid":
|
|
15278
|
+
"aria-invalid": hasError,
|
|
15279
|
+
style: { gridArea: "input" },
|
|
15256
15280
|
...props
|
|
15257
15281
|
};
|
|
15258
15282
|
if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
|
|
@@ -15282,28 +15306,38 @@ var FormField = ({
|
|
|
15282
15306
|
StyledFormField,
|
|
15283
15307
|
{
|
|
15284
15308
|
...props,
|
|
15309
|
+
$hasError: hasError,
|
|
15285
15310
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
15286
15311
|
children: [
|
|
15287
|
-
|
|
15288
|
-
|
|
15312
|
+
shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(
|
|
15313
|
+
Stack,
|
|
15289
15314
|
{
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15315
|
+
direction: "vertical",
|
|
15316
|
+
gap: "space-01",
|
|
15317
|
+
style: {
|
|
15318
|
+
gridArea: "label-description"
|
|
15319
|
+
},
|
|
15320
|
+
children: [
|
|
15321
|
+
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
15322
|
+
Label,
|
|
15323
|
+
{
|
|
15324
|
+
htmlFor: computedId,
|
|
15325
|
+
required,
|
|
15326
|
+
children: label
|
|
15327
|
+
}
|
|
15328
|
+
),
|
|
15329
|
+
hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null
|
|
15330
|
+
]
|
|
15293
15331
|
}
|
|
15294
|
-
),
|
|
15295
|
-
(0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
15332
|
+
) : null,
|
|
15296
15333
|
(0, import_react73.cloneElement)(children, childProps),
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
}
|
|
15305
|
-
)
|
|
15306
|
-
] }) : null
|
|
15334
|
+
hasError ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
15335
|
+
ErrorMessages,
|
|
15336
|
+
{
|
|
15337
|
+
errors: computedError,
|
|
15338
|
+
id: errorId
|
|
15339
|
+
}
|
|
15340
|
+
) : null
|
|
15307
15341
|
]
|
|
15308
15342
|
}
|
|
15309
15343
|
);
|
|
@@ -17686,7 +17720,6 @@ var Table = ({
|
|
|
17686
17720
|
};
|
|
17687
17721
|
|
|
17688
17722
|
// src/components/Table/TableBody.tsx
|
|
17689
|
-
var import_react93 = require("react");
|
|
17690
17723
|
var import_styled_components116 = require("styled-components");
|
|
17691
17724
|
|
|
17692
17725
|
// src/components/Table/TableSectionContext.ts
|
|
@@ -17701,7 +17734,7 @@ var TableBody = ({ children, ...props }) => {
|
|
|
17701
17734
|
};
|
|
17702
17735
|
|
|
17703
17736
|
// src/components/Table/TableCell.tsx
|
|
17704
|
-
var
|
|
17737
|
+
var import_react93 = require("react");
|
|
17705
17738
|
var import_styled_components117 = require("styled-components");
|
|
17706
17739
|
var import_jsx_runtime321 = require("react/jsx-runtime");
|
|
17707
17740
|
var sharedStyles = import_styled_components117.css`
|
|
@@ -17722,7 +17755,7 @@ var StyledTd = import_styled_components117.styled.td`
|
|
|
17722
17755
|
line-height: var(--wui-typography-body-2-line-height);
|
|
17723
17756
|
`;
|
|
17724
17757
|
var TableCell = ({ children, ...props }) => {
|
|
17725
|
-
const section = (0,
|
|
17758
|
+
const section = (0, import_react93.useContext)(TableSectionContext);
|
|
17726
17759
|
if (section === "head") {
|
|
17727
17760
|
return /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(StyledTh, { ...props, children });
|
|
17728
17761
|
}
|
|
@@ -17730,7 +17763,6 @@ var TableCell = ({ children, ...props }) => {
|
|
|
17730
17763
|
};
|
|
17731
17764
|
|
|
17732
17765
|
// src/components/Table/TableFoot.tsx
|
|
17733
|
-
var import_react95 = require("react");
|
|
17734
17766
|
var import_styled_components118 = require("styled-components");
|
|
17735
17767
|
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
17736
17768
|
var StyledTableFoot = import_styled_components118.styled.tfoot``;
|
|
@@ -17739,7 +17771,6 @@ var TableFoot = ({ children, ...props }) => {
|
|
|
17739
17771
|
};
|
|
17740
17772
|
|
|
17741
17773
|
// src/components/Table/TableHead.tsx
|
|
17742
|
-
var import_react96 = require("react");
|
|
17743
17774
|
var import_styled_components119 = require("styled-components");
|
|
17744
17775
|
var import_jsx_runtime323 = require("react/jsx-runtime");
|
|
17745
17776
|
var StyledThead = import_styled_components119.styled.thead``;
|
|
@@ -17757,15 +17788,15 @@ var TableRow = ({ children, ...props }) => {
|
|
|
17757
17788
|
|
|
17758
17789
|
// src/components/Tabs/Tabs.tsx
|
|
17759
17790
|
var import_react_tabs = require("@radix-ui/react-tabs");
|
|
17760
|
-
var
|
|
17791
|
+
var import_react95 = require("react");
|
|
17761
17792
|
var import_type_guards68 = require("@wistia/type-guards");
|
|
17762
17793
|
|
|
17763
17794
|
// src/components/Tabs/useTabsValue.tsx
|
|
17764
|
-
var
|
|
17765
|
-
var TabsValueContext = (0,
|
|
17795
|
+
var import_react94 = require("react");
|
|
17796
|
+
var TabsValueContext = (0, import_react94.createContext)(null);
|
|
17766
17797
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
17767
17798
|
var useTabsValue = () => {
|
|
17768
|
-
const context = (0,
|
|
17799
|
+
const context = (0, import_react94.useContext)(TabsValueContext);
|
|
17769
17800
|
if (context === null) {
|
|
17770
17801
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
17771
17802
|
}
|
|
@@ -17781,8 +17812,8 @@ var Tabs = ({
|
|
|
17781
17812
|
defaultValue,
|
|
17782
17813
|
...props
|
|
17783
17814
|
}) => {
|
|
17784
|
-
const [value, setValue] = (0,
|
|
17785
|
-
const onValueChange = (0,
|
|
17815
|
+
const [value, setValue] = (0, import_react95.useState)(valueProp ?? defaultValue);
|
|
17816
|
+
const onValueChange = (0, import_react95.useCallback)(
|
|
17786
17817
|
(newValue) => {
|
|
17787
17818
|
setValue(newValue);
|
|
17788
17819
|
if (onValueChangeProp) {
|
|
@@ -17866,7 +17897,7 @@ var TabsList = ({ children, fullWidth = true, ...props }) => {
|
|
|
17866
17897
|
TabsList.displayName = "TabsList_UI";
|
|
17867
17898
|
|
|
17868
17899
|
// src/components/Tabs/TabsTrigger.tsx
|
|
17869
|
-
var
|
|
17900
|
+
var import_react96 = require("react");
|
|
17870
17901
|
var import_type_guards70 = require("@wistia/type-guards");
|
|
17871
17902
|
|
|
17872
17903
|
// src/components/Tabs/StyledRadixTabsTrigger.tsx
|
|
@@ -17882,13 +17913,13 @@ var StyledRadixTabsTrigger = (0, import_styled_components123.styled)(import_reac
|
|
|
17882
17913
|
|
|
17883
17914
|
// src/components/Tabs/TabsTrigger.tsx
|
|
17884
17915
|
var import_jsx_runtime329 = require("react/jsx-runtime");
|
|
17885
|
-
var TabsTrigger = (0,
|
|
17916
|
+
var TabsTrigger = (0, import_react96.forwardRef)(
|
|
17886
17917
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value, ...otherProps }, forwardedRef) => {
|
|
17887
17918
|
const selectedValue = useTabsValue();
|
|
17888
17919
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
17889
|
-
const buttonRef = (0,
|
|
17920
|
+
const buttonRef = (0, import_react96.useRef)(null);
|
|
17890
17921
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
17891
|
-
(0,
|
|
17922
|
+
(0, import_react96.useEffect)(() => {
|
|
17892
17923
|
const buttonElem = buttonRef.current;
|
|
17893
17924
|
if (!buttonElem) {
|
|
17894
17925
|
return void 0;
|
|
@@ -17970,7 +18001,7 @@ var ThumbnailBadge = ({ icon, label, ...props }) => {
|
|
|
17970
18001
|
ThumbnailBadge.displayName = "ThumbnailBadge_UI";
|
|
17971
18002
|
|
|
17972
18003
|
// src/components/Thumbnail/Thumbnail.tsx
|
|
17973
|
-
var
|
|
18004
|
+
var import_react97 = require("react");
|
|
17974
18005
|
var import_styled_components127 = require("styled-components");
|
|
17975
18006
|
var import_type_guards74 = require("@wistia/type-guards");
|
|
17976
18007
|
|
|
@@ -18352,7 +18383,7 @@ var getRelativeMousePosition = (elem, mouseEvent) => {
|
|
|
18352
18383
|
var hasValidThumbnailUrl = (thumbnailUrl) => {
|
|
18353
18384
|
return (0, import_type_guards74.isNotNil)(thumbnailUrl) && (0, import_type_guards74.isNonEmptyString)(thumbnailUrl);
|
|
18354
18385
|
};
|
|
18355
|
-
var Thumbnail = (0,
|
|
18386
|
+
var Thumbnail = (0, import_react97.forwardRef)(
|
|
18356
18387
|
({
|
|
18357
18388
|
gradientBackground = "defaultMidOne",
|
|
18358
18389
|
thumbnailImageType = "wide",
|
|
@@ -18364,17 +18395,17 @@ var Thumbnail = (0, import_react100.forwardRef)(
|
|
|
18364
18395
|
aspectRatio = "wide",
|
|
18365
18396
|
...props
|
|
18366
18397
|
}, ref) => {
|
|
18367
|
-
const [percent, setPercent] = (0,
|
|
18368
|
-
const [isMouseOver, setIsMouseOver] = (0,
|
|
18369
|
-
const [isStoryboardReady, setIsStoryboardReady] = (0,
|
|
18370
|
-
const storyboardElementRef = (0,
|
|
18371
|
-
const [cursorPosition, setCursorPosition] = (0,
|
|
18372
|
-
const backgroundUrl = (0,
|
|
18398
|
+
const [percent, setPercent] = (0, import_react97.useState)(0);
|
|
18399
|
+
const [isMouseOver, setIsMouseOver] = (0, import_react97.useState)(false);
|
|
18400
|
+
const [isStoryboardReady, setIsStoryboardReady] = (0, import_react97.useState)(false);
|
|
18401
|
+
const storyboardElementRef = (0, import_react97.useRef)(null);
|
|
18402
|
+
const [cursorPosition, setCursorPosition] = (0, import_react97.useState)(null);
|
|
18403
|
+
const backgroundUrl = (0, import_react97.useMemo)(
|
|
18373
18404
|
() => thumbnailImageType === "square" && hasValidThumbnailUrl(thumbnailUrl) ? thumbnailUrl : void 0,
|
|
18374
18405
|
[thumbnailImageType, thumbnailUrl]
|
|
18375
18406
|
);
|
|
18376
18407
|
const isScrubbable = (0, import_type_guards74.isNotNil)(storyboard);
|
|
18377
|
-
const trackStoryboardLoadStatus = (0,
|
|
18408
|
+
const trackStoryboardLoadStatus = (0, import_react97.useCallback)(() => {
|
|
18378
18409
|
if (storyboardElementRef.current || !storyboard) {
|
|
18379
18410
|
return storyboardElementRef.current;
|
|
18380
18411
|
}
|
|
@@ -18384,7 +18415,7 @@ var Thumbnail = (0, import_react100.forwardRef)(
|
|
|
18384
18415
|
storyboardElementRef.current = asset;
|
|
18385
18416
|
return storyboardElementRef.current;
|
|
18386
18417
|
}, [storyboard]);
|
|
18387
|
-
const handleMouseMove = (0,
|
|
18418
|
+
const handleMouseMove = (0, import_react97.useCallback)(
|
|
18388
18419
|
(mouseEvent) => {
|
|
18389
18420
|
if (!isScrubbable) return;
|
|
18390
18421
|
const elem = mouseEvent.currentTarget;
|
|
@@ -18397,12 +18428,12 @@ var Thumbnail = (0, import_react100.forwardRef)(
|
|
|
18397
18428
|
},
|
|
18398
18429
|
[isScrubbable, trackStoryboardLoadStatus]
|
|
18399
18430
|
);
|
|
18400
|
-
const handleMouseOut = (0,
|
|
18431
|
+
const handleMouseOut = (0, import_react97.useCallback)(() => {
|
|
18401
18432
|
if (!isScrubbable) return;
|
|
18402
18433
|
setIsMouseOver(false);
|
|
18403
18434
|
setCursorPosition(null);
|
|
18404
18435
|
}, [isScrubbable]);
|
|
18405
|
-
const shouldRenderStoryboard = (0,
|
|
18436
|
+
const shouldRenderStoryboard = (0, import_react97.useMemo)(() => {
|
|
18406
18437
|
if ((0, import_type_guards74.isNil)(storyboard) || (0, import_type_guards74.isUndefined)(height) || (0, import_type_guards74.isEmptyString)(height)) {
|
|
18407
18438
|
return false;
|
|
18408
18439
|
}
|
|
@@ -18464,7 +18495,7 @@ var Thumbnail = (0, import_react100.forwardRef)(
|
|
|
18464
18495
|
Thumbnail.displayName = "Thumbnail_UI";
|
|
18465
18496
|
|
|
18466
18497
|
// src/components/ThumbnailCollage/ThumbnailCollage.tsx
|
|
18467
|
-
var
|
|
18498
|
+
var import_react98 = require("react");
|
|
18468
18499
|
var import_styled_components128 = require("styled-components");
|
|
18469
18500
|
var import_type_guards75 = require("@wistia/type-guards");
|
|
18470
18501
|
var import_jsx_runtime333 = (
|
|
@@ -18526,10 +18557,10 @@ var ThumbnailCollage = ({
|
|
|
18526
18557
|
gradientBackground = "defaultMidOne",
|
|
18527
18558
|
...props
|
|
18528
18559
|
}) => {
|
|
18529
|
-
const thumbnailArray =
|
|
18560
|
+
const thumbnailArray = import_react98.Children.toArray(children);
|
|
18530
18561
|
const truncatedThumbnails = thumbnailArray.slice(0, 3);
|
|
18531
18562
|
const thumbnails = (0, import_type_guards75.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
|
|
18532
|
-
return
|
|
18563
|
+
return (0, import_react98.cloneElement)(child, {
|
|
18533
18564
|
...child.props,
|
|
18534
18565
|
children: void 0
|
|
18535
18566
|
});
|
|
@@ -18682,7 +18713,7 @@ WistiaLogo.displayName = "WistiaLogo_UI";
|
|
|
18682
18713
|
// src/components/SplitButton/SplitButton.tsx
|
|
18683
18714
|
var import_styled_components130 = require("styled-components");
|
|
18684
18715
|
var import_type_guards77 = require("@wistia/type-guards");
|
|
18685
|
-
var
|
|
18716
|
+
var import_react99 = require("react");
|
|
18686
18717
|
var import_jsx_runtime335 = require("react/jsx-runtime");
|
|
18687
18718
|
var StyledSplitButton = import_styled_components130.styled.span`
|
|
18688
18719
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -18747,7 +18778,7 @@ var SplitButton = ({
|
|
|
18747
18778
|
children: menuItems
|
|
18748
18779
|
}
|
|
18749
18780
|
),
|
|
18750
|
-
(0, import_type_guards77.isNotNil)(secondaryAction) && (0,
|
|
18781
|
+
(0, import_type_guards77.isNotNil)(secondaryAction) && (0, import_react99.cloneElement)(secondaryAction, { disabled, size, unstyled, variant, colorScheme })
|
|
18751
18782
|
] });
|
|
18752
18783
|
};
|
|
18753
18784
|
SplitButton.displayName = "SplitButton_UI";
|