@wistia/ui 0.18.17 → 0.18.18-beta.52b38c67.eabff6e
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 +110 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +173 -121
- 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.
|
|
3
|
+
* @license @wistia/ui v0.18.18-beta.52b38c67.eabff6e
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -14110,12 +14110,22 @@ var import_react62 = require("react");
|
|
|
14110
14110
|
var import_styled_components77 = require("styled-components");
|
|
14111
14111
|
var import_type_guards44 = require("@wistia/type-guards");
|
|
14112
14112
|
var import_jsx_runtime278 = require("react/jsx-runtime");
|
|
14113
|
+
var pulse = import_styled_components77.keyframes`
|
|
14114
|
+
0%,
|
|
14115
|
+
100% {
|
|
14116
|
+
opacity: 1;
|
|
14117
|
+
}
|
|
14118
|
+
50% {
|
|
14119
|
+
opacity: 0.5;
|
|
14120
|
+
}
|
|
14121
|
+
`;
|
|
14113
14122
|
var StyledDataCard = import_styled_components77.styled.div`
|
|
14114
14123
|
--wui-data-card-text: var(--wui-color-text-button);
|
|
14115
14124
|
--wui-color-text: var(--wui-data-card-text);
|
|
14116
14125
|
--wui-data-card-background: var(--wui-color-bg-surface-secondary);
|
|
14117
14126
|
--wui-data-card-background-hover: var(--wui-color-bg-surface-secondary-hover);
|
|
14118
14127
|
--wui-data-card-background-active: var(--wui-color-bg-surface-secondary-active);
|
|
14128
|
+
--wui-data-card-skeleton-color: var(--wui-color-bg-surface-tertiary);
|
|
14119
14129
|
|
|
14120
14130
|
display: grid;
|
|
14121
14131
|
grid-template-areas: 'label slot' 'value value';
|
|
@@ -14143,6 +14153,16 @@ var StyledDataCard = import_styled_components77.styled.div`
|
|
|
14143
14153
|
grid-template-rows: auto auto auto;
|
|
14144
14154
|
}
|
|
14145
14155
|
|
|
14156
|
+
[data-wui-data-card-skeleton='true'] {
|
|
14157
|
+
pointer-events: none;
|
|
14158
|
+
background-color: var(--wui-data-card-skeleton-color);
|
|
14159
|
+
animation: ${pulse} 1.5s var(--wui-motion-ease-in-out) 0.5s infinite;
|
|
14160
|
+
color: transparent;
|
|
14161
|
+
user-select: none;
|
|
14162
|
+
border-radius: var(--wui-border-radius-01);
|
|
14163
|
+
width: fit-content;
|
|
14164
|
+
}
|
|
14165
|
+
|
|
14146
14166
|
&[data-click-region] {
|
|
14147
14167
|
&:not([disabled]) {
|
|
14148
14168
|
cursor: pointer;
|
|
@@ -14174,6 +14194,7 @@ var StyledDataCard = import_styled_components77.styled.div`
|
|
|
14174
14194
|
--wui-data-card-background-hover: var(--wui-color-bg-surface-selected-hover);
|
|
14175
14195
|
--wui-data-card-background-active: var(--wui-color-bg-surface-selected-active);
|
|
14176
14196
|
--wui-data-card-focus-ring: var(--wui-color-border-selected);
|
|
14197
|
+
--wui-data-card-skeleton-color: var(--wui-color-bg-surface-selected-active);
|
|
14177
14198
|
}
|
|
14178
14199
|
}
|
|
14179
14200
|
|
|
@@ -14184,38 +14205,23 @@ var StyledDataCard = import_styled_components77.styled.div`
|
|
|
14184
14205
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
14185
14206
|
}
|
|
14186
14207
|
`;
|
|
14187
|
-
var shimmer = import_styled_components77.keyframes`
|
|
14188
|
-
0% {
|
|
14189
|
-
background-position: 200% 0;
|
|
14190
|
-
}
|
|
14191
|
-
100% {
|
|
14192
|
-
background-position: -200% 0;
|
|
14193
|
-
}
|
|
14194
|
-
`;
|
|
14195
|
-
var LoadingBackground = import_styled_components77.styled.div`
|
|
14196
|
-
background: linear-gradient(
|
|
14197
|
-
90deg,
|
|
14198
|
-
var(--wui-color-bg-surface-tertiary) 25%,
|
|
14199
|
-
var(--wui-color-bg-surface-secondary) 37%,
|
|
14200
|
-
var(--wui-color-bg-surface-tertiary) 63%
|
|
14201
|
-
);
|
|
14202
|
-
background-size: 200% 100%;
|
|
14203
|
-
animation: ${shimmer} 1.5s infinite;
|
|
14204
|
-
border-radius: var(--wui-border-radius-01);
|
|
14205
|
-
`;
|
|
14206
|
-
var StyledLoadingLabel = (0, import_styled_components77.styled)(LoadingBackground)`
|
|
14207
|
-
width: 80px;
|
|
14208
|
-
height: var(--wui-typography-heading-6-line-height);
|
|
14209
|
-
`;
|
|
14210
|
-
var StyledLoadingValue = (0, import_styled_components77.styled)(LoadingBackground)`
|
|
14211
|
-
width: 90%;
|
|
14212
|
-
height: var(--wui-typography-heading-3-line-height);
|
|
14213
|
-
`;
|
|
14214
14208
|
var StyledLabel3 = (0, import_styled_components77.styled)(Heading)`
|
|
14215
14209
|
grid-area: label;
|
|
14210
|
+
|
|
14211
|
+
&[data-wui-data-card-skeleton='true'] {
|
|
14212
|
+
width: 80px;
|
|
14213
|
+
}
|
|
14214
|
+
|
|
14215
|
+
button {
|
|
14216
|
+
text-align: left;
|
|
14217
|
+
}
|
|
14216
14218
|
`;
|
|
14217
14219
|
var StyledValue = (0, import_styled_components77.styled)(Heading)`
|
|
14218
14220
|
grid-area: value;
|
|
14221
|
+
|
|
14222
|
+
&[data-wui-data-card-skeleton='true'] {
|
|
14223
|
+
width: min(90%, 156px);
|
|
14224
|
+
}
|
|
14219
14225
|
`;
|
|
14220
14226
|
var StyledSlot = import_styled_components77.styled.div`
|
|
14221
14227
|
display: flex;
|
|
@@ -14249,17 +14255,19 @@ var DataCardInner = ({
|
|
|
14249
14255
|
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
14250
14256
|
StyledLabel3,
|
|
14251
14257
|
{
|
|
14252
|
-
|
|
14258
|
+
"data-wui-data-card-skeleton": isLoading,
|
|
14259
|
+
renderAs: "div",
|
|
14253
14260
|
variant: "heading6",
|
|
14254
|
-
children:
|
|
14261
|
+
children: label
|
|
14255
14262
|
}
|
|
14256
14263
|
),
|
|
14257
14264
|
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
14258
14265
|
StyledValue,
|
|
14259
14266
|
{
|
|
14260
|
-
|
|
14267
|
+
"data-wui-data-card-skeleton": isLoading,
|
|
14268
|
+
renderAs: "div",
|
|
14261
14269
|
variant: "heading3",
|
|
14262
|
-
children:
|
|
14270
|
+
children: value
|
|
14263
14271
|
}
|
|
14264
14272
|
),
|
|
14265
14273
|
(0, import_type_guards44.isNotNil)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
@@ -14310,9 +14318,16 @@ var import_styled_components78 = require("styled-components");
|
|
|
14310
14318
|
var import_jsx_runtime279 = require("react/jsx-runtime");
|
|
14311
14319
|
var StyledDataCards = (0, import_styled_components78.styled)(Box)`
|
|
14312
14320
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
14321
|
+
--wui-data-cards-column-count: ${({ $columns }) => $columns === "auto" ? void 0 : $columns};
|
|
14322
|
+
--wui-data-cards-total-column-gap-width: calc(var(--wui-data-cards-column-count) - 1) *
|
|
14323
|
+
var(--wui-space-02);
|
|
14324
|
+
--wui-data-cards-column-width: calc(
|
|
14325
|
+
(100% - var(--wui-data-cards-total-column-gap-width)) / var(--wui-data-cards-column-count)
|
|
14326
|
+
);
|
|
14313
14327
|
|
|
14314
14328
|
> * {
|
|
14315
14329
|
min-width: 120px;
|
|
14330
|
+
flex-basis: var(--wui-data-cards-column-width, 0);
|
|
14316
14331
|
max-width: ${({ $cardMaxWidth }) => $cardMaxWidth};
|
|
14317
14332
|
}
|
|
14318
14333
|
`;
|
|
@@ -14320,19 +14335,22 @@ var DataCards = ({
|
|
|
14320
14335
|
children,
|
|
14321
14336
|
cardMaxWidth = "none",
|
|
14322
14337
|
colorScheme = "inherit",
|
|
14338
|
+
columns = "auto",
|
|
14323
14339
|
...props
|
|
14324
14340
|
}) => {
|
|
14341
|
+
const responsiveCardMaxWidth = useResponsiveProp(cardMaxWidth);
|
|
14342
|
+
const responsiveColumns = useResponsiveProp(columns);
|
|
14325
14343
|
return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
|
|
14326
14344
|
StyledDataCards,
|
|
14327
14345
|
{
|
|
14328
14346
|
...props,
|
|
14329
|
-
$cardMaxWidth:
|
|
14347
|
+
$cardMaxWidth: responsiveCardMaxWidth,
|
|
14330
14348
|
$colorScheme: colorScheme,
|
|
14349
|
+
$columns: responsiveColumns,
|
|
14331
14350
|
alignItems: "stretch",
|
|
14332
14351
|
direction: "row",
|
|
14333
14352
|
fill: "horizontal",
|
|
14334
14353
|
gap: "space-02",
|
|
14335
|
-
renderAs: "dl",
|
|
14336
14354
|
wrapItems: true,
|
|
14337
14355
|
children
|
|
14338
14356
|
}
|
|
@@ -15226,8 +15244,20 @@ var import_react73 = require("react");
|
|
|
15226
15244
|
var import_styled_components87 = require("styled-components");
|
|
15227
15245
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
15228
15246
|
var import_jsx_runtime293 = require("react/jsx-runtime");
|
|
15247
|
+
var inlineErrorStyles = import_styled_components87.css`
|
|
15248
|
+
grid-template-rows: 1fr auto;
|
|
15249
|
+
grid-template-areas: 'label-description input' '. error';
|
|
15250
|
+
`;
|
|
15251
|
+
var inlineBaseGridAreaStyles = import_styled_components87.css`
|
|
15252
|
+
grid-template-rows: 1fr;
|
|
15253
|
+
grid-template-areas: 'label-description input';
|
|
15254
|
+
`;
|
|
15255
|
+
var blockGridErrorStyles = import_styled_components87.css`
|
|
15256
|
+
grid-template-rows: auto 1fr auto;
|
|
15257
|
+
grid-template-areas: 'label-description' 'input' 'error';
|
|
15258
|
+
`;
|
|
15229
15259
|
var StyledFormField = import_styled_components87.styled.div`
|
|
15230
|
-
--form-field-spacing: var(--wui-space-
|
|
15260
|
+
--form-field-spacing: var(--wui-space-02);
|
|
15231
15261
|
--form-field-spacing-inline: var(--wui-space-02);
|
|
15232
15262
|
--form-field-error-color: var(--wui-color-text-secondary-error);
|
|
15233
15263
|
|
|
@@ -15241,21 +15271,28 @@ var StyledFormField = import_styled_components87.styled.div`
|
|
|
15241
15271
|
&[data-label-position='inline-compact'] {
|
|
15242
15272
|
gap: var(--form-field-spacing-inline);
|
|
15243
15273
|
grid-template-columns: auto 1fr;
|
|
15244
|
-
|
|
15274
|
+
${inlineBaseGridAreaStyles}
|
|
15275
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15245
15276
|
}
|
|
15246
15277
|
|
|
15247
15278
|
&[data-label-position='inline'] {
|
|
15248
15279
|
gap: var(--form-field-spacing-inline);
|
|
15249
15280
|
grid-template-columns: minmax(auto, 1fr) 1fr;
|
|
15250
|
-
|
|
15281
|
+
${inlineBaseGridAreaStyles}
|
|
15282
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15251
15283
|
}
|
|
15252
15284
|
|
|
15253
15285
|
&[data-label-position='block'] {
|
|
15254
15286
|
gap: var(--form-field-spacing);
|
|
15255
15287
|
grid-template-columns: 1fr;
|
|
15256
|
-
grid-template-rows: 1fr;
|
|
15288
|
+
grid-template-rows: auto 1fr;
|
|
15289
|
+
grid-template-areas: 'label-description' 'input';
|
|
15290
|
+
${({ $hasError }) => $hasError && blockGridErrorStyles}
|
|
15257
15291
|
}
|
|
15258
15292
|
`;
|
|
15293
|
+
var ErrorText = (0, import_styled_components87.styled)(Text)`
|
|
15294
|
+
grid-area: error;
|
|
15295
|
+
`;
|
|
15259
15296
|
var StyledErrorList = import_styled_components87.styled.ul`
|
|
15260
15297
|
margin: 0;
|
|
15261
15298
|
padding: 0;
|
|
@@ -15263,13 +15300,14 @@ var StyledErrorList = import_styled_components87.styled.ul`
|
|
|
15263
15300
|
display: flex;
|
|
15264
15301
|
flex-direction: column;
|
|
15265
15302
|
gap: var(--wui-space-01);
|
|
15303
|
+
grid-area: error;
|
|
15266
15304
|
`;
|
|
15267
15305
|
var ErrorMessages = ({ errors, id }) => {
|
|
15268
15306
|
const isErrorArray = (0, import_type_guards49.isArray)(errors);
|
|
15269
15307
|
const isMultipleErrors = isErrorArray && errors.length > 1;
|
|
15270
15308
|
if (!isErrorArray) {
|
|
15271
15309
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15272
|
-
|
|
15310
|
+
ErrorText,
|
|
15273
15311
|
{
|
|
15274
15312
|
colorScheme: "error",
|
|
15275
15313
|
id,
|
|
@@ -15282,7 +15320,7 @@ var ErrorMessages = ({ errors, id }) => {
|
|
|
15282
15320
|
}
|
|
15283
15321
|
if (!isMultipleErrors) {
|
|
15284
15322
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15285
|
-
|
|
15323
|
+
ErrorText,
|
|
15286
15324
|
{
|
|
15287
15325
|
colorScheme: "error",
|
|
15288
15326
|
id,
|
|
@@ -15327,12 +15365,16 @@ var FormField = ({
|
|
|
15327
15365
|
const descriptionId = `${computedId}-description`;
|
|
15328
15366
|
const errorId = `${computedId}-error`;
|
|
15329
15367
|
const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
|
|
15368
|
+
const hasDescription = (0, import_type_guards49.isNotNil)(description);
|
|
15369
|
+
const hasError = (0, import_type_guards49.isNotNil)(computedError);
|
|
15370
|
+
const shouldRenderLabelDescriptionWrapper = !isIntegratedLabel || hasDescription;
|
|
15330
15371
|
let childProps = {
|
|
15331
15372
|
name,
|
|
15332
15373
|
id: computedId,
|
|
15333
15374
|
label: isIntegratedLabel ? label : void 0,
|
|
15334
15375
|
"aria-describedby": ariaDescribedby,
|
|
15335
|
-
"aria-invalid":
|
|
15376
|
+
"aria-invalid": hasError,
|
|
15377
|
+
style: { gridArea: "input" },
|
|
15336
15378
|
...props
|
|
15337
15379
|
};
|
|
15338
15380
|
if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
|
|
@@ -15362,28 +15404,38 @@ var FormField = ({
|
|
|
15362
15404
|
StyledFormField,
|
|
15363
15405
|
{
|
|
15364
15406
|
...props,
|
|
15407
|
+
$hasError: hasError,
|
|
15365
15408
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
15366
15409
|
children: [
|
|
15367
|
-
|
|
15368
|
-
|
|
15410
|
+
shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
|
|
15411
|
+
Stack,
|
|
15369
15412
|
{
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15413
|
+
direction: "vertical",
|
|
15414
|
+
gap: "space-01",
|
|
15415
|
+
style: {
|
|
15416
|
+
gridArea: "label-description"
|
|
15417
|
+
},
|
|
15418
|
+
children: [
|
|
15419
|
+
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15420
|
+
Label,
|
|
15421
|
+
{
|
|
15422
|
+
htmlFor: computedId,
|
|
15423
|
+
required,
|
|
15424
|
+
children: label
|
|
15425
|
+
}
|
|
15426
|
+
),
|
|
15427
|
+
hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null
|
|
15428
|
+
]
|
|
15373
15429
|
}
|
|
15374
|
-
),
|
|
15375
|
-
(0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
15430
|
+
) : null,
|
|
15376
15431
|
(0, import_react73.cloneElement)(children, childProps),
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
}
|
|
15385
|
-
)
|
|
15386
|
-
] }) : null
|
|
15432
|
+
hasError ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15433
|
+
ErrorMessages,
|
|
15434
|
+
{
|
|
15435
|
+
errors: computedError,
|
|
15436
|
+
id: errorId
|
|
15437
|
+
}
|
|
15438
|
+
) : null
|
|
15387
15439
|
]
|
|
15388
15440
|
}
|
|
15389
15441
|
);
|