@wistia/ui 0.18.17 → 0.18.18-beta.c603c0ce.1c25242
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 +92 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +155 -117
- 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.c603c0ce.1c25242
|
|
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,19 @@ 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
|
+
}
|
|
14216
14214
|
`;
|
|
14217
14215
|
var StyledValue = (0, import_styled_components77.styled)(Heading)`
|
|
14218
14216
|
grid-area: value;
|
|
14217
|
+
|
|
14218
|
+
&[data-wui-data-card-skeleton='true'] {
|
|
14219
|
+
width: min(90%, 156px);
|
|
14220
|
+
}
|
|
14219
14221
|
`;
|
|
14220
14222
|
var StyledSlot = import_styled_components77.styled.div`
|
|
14221
14223
|
display: flex;
|
|
@@ -14249,17 +14251,19 @@ var DataCardInner = ({
|
|
|
14249
14251
|
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
14250
14252
|
StyledLabel3,
|
|
14251
14253
|
{
|
|
14254
|
+
"data-wui-data-card-skeleton": isLoading,
|
|
14252
14255
|
renderAs: "dt",
|
|
14253
14256
|
variant: "heading6",
|
|
14254
|
-
children:
|
|
14257
|
+
children: label
|
|
14255
14258
|
}
|
|
14256
14259
|
),
|
|
14257
14260
|
/* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
|
|
14258
14261
|
StyledValue,
|
|
14259
14262
|
{
|
|
14263
|
+
"data-wui-data-card-skeleton": isLoading,
|
|
14260
14264
|
renderAs: "dd",
|
|
14261
14265
|
variant: "heading3",
|
|
14262
|
-
children:
|
|
14266
|
+
children: value
|
|
14263
14267
|
}
|
|
14264
14268
|
),
|
|
14265
14269
|
(0, import_type_guards44.isNotNil)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
@@ -15226,8 +15230,20 @@ var import_react73 = require("react");
|
|
|
15226
15230
|
var import_styled_components87 = require("styled-components");
|
|
15227
15231
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
15228
15232
|
var import_jsx_runtime293 = require("react/jsx-runtime");
|
|
15233
|
+
var inlineErrorStyles = import_styled_components87.css`
|
|
15234
|
+
grid-template-rows: 1fr auto;
|
|
15235
|
+
grid-template-areas: 'label-description input' '. error';
|
|
15236
|
+
`;
|
|
15237
|
+
var inlineBaseGridAreaStyles = import_styled_components87.css`
|
|
15238
|
+
grid-template-rows: 1fr;
|
|
15239
|
+
grid-template-areas: 'label-description input';
|
|
15240
|
+
`;
|
|
15241
|
+
var blockGridErrorStyles = import_styled_components87.css`
|
|
15242
|
+
grid-template-rows: auto 1fr auto;
|
|
15243
|
+
grid-template-areas: 'label-description' 'input' 'error';
|
|
15244
|
+
`;
|
|
15229
15245
|
var StyledFormField = import_styled_components87.styled.div`
|
|
15230
|
-
--form-field-spacing: var(--wui-space-
|
|
15246
|
+
--form-field-spacing: var(--wui-space-02);
|
|
15231
15247
|
--form-field-spacing-inline: var(--wui-space-02);
|
|
15232
15248
|
--form-field-error-color: var(--wui-color-text-secondary-error);
|
|
15233
15249
|
|
|
@@ -15241,21 +15257,28 @@ var StyledFormField = import_styled_components87.styled.div`
|
|
|
15241
15257
|
&[data-label-position='inline-compact'] {
|
|
15242
15258
|
gap: var(--form-field-spacing-inline);
|
|
15243
15259
|
grid-template-columns: auto 1fr;
|
|
15244
|
-
|
|
15260
|
+
${inlineBaseGridAreaStyles}
|
|
15261
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15245
15262
|
}
|
|
15246
15263
|
|
|
15247
15264
|
&[data-label-position='inline'] {
|
|
15248
15265
|
gap: var(--form-field-spacing-inline);
|
|
15249
15266
|
grid-template-columns: minmax(auto, 1fr) 1fr;
|
|
15250
|
-
|
|
15267
|
+
${inlineBaseGridAreaStyles}
|
|
15268
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15251
15269
|
}
|
|
15252
15270
|
|
|
15253
15271
|
&[data-label-position='block'] {
|
|
15254
15272
|
gap: var(--form-field-spacing);
|
|
15255
15273
|
grid-template-columns: 1fr;
|
|
15256
|
-
grid-template-rows: 1fr;
|
|
15274
|
+
grid-template-rows: auto 1fr;
|
|
15275
|
+
grid-template-areas: 'label-description' 'input';
|
|
15276
|
+
${({ $hasError }) => $hasError && blockGridErrorStyles}
|
|
15257
15277
|
}
|
|
15258
15278
|
`;
|
|
15279
|
+
var ErrorText = (0, import_styled_components87.styled)(Text)`
|
|
15280
|
+
grid-area: error;
|
|
15281
|
+
`;
|
|
15259
15282
|
var StyledErrorList = import_styled_components87.styled.ul`
|
|
15260
15283
|
margin: 0;
|
|
15261
15284
|
padding: 0;
|
|
@@ -15263,13 +15286,14 @@ var StyledErrorList = import_styled_components87.styled.ul`
|
|
|
15263
15286
|
display: flex;
|
|
15264
15287
|
flex-direction: column;
|
|
15265
15288
|
gap: var(--wui-space-01);
|
|
15289
|
+
grid-area: error;
|
|
15266
15290
|
`;
|
|
15267
15291
|
var ErrorMessages = ({ errors, id }) => {
|
|
15268
15292
|
const isErrorArray = (0, import_type_guards49.isArray)(errors);
|
|
15269
15293
|
const isMultipleErrors = isErrorArray && errors.length > 1;
|
|
15270
15294
|
if (!isErrorArray) {
|
|
15271
15295
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15272
|
-
|
|
15296
|
+
ErrorText,
|
|
15273
15297
|
{
|
|
15274
15298
|
colorScheme: "error",
|
|
15275
15299
|
id,
|
|
@@ -15282,7 +15306,7 @@ var ErrorMessages = ({ errors, id }) => {
|
|
|
15282
15306
|
}
|
|
15283
15307
|
if (!isMultipleErrors) {
|
|
15284
15308
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15285
|
-
|
|
15309
|
+
ErrorText,
|
|
15286
15310
|
{
|
|
15287
15311
|
colorScheme: "error",
|
|
15288
15312
|
id,
|
|
@@ -15327,12 +15351,16 @@ var FormField = ({
|
|
|
15327
15351
|
const descriptionId = `${computedId}-description`;
|
|
15328
15352
|
const errorId = `${computedId}-error`;
|
|
15329
15353
|
const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
|
|
15354
|
+
const hasDescription = (0, import_type_guards49.isNotNil)(description);
|
|
15355
|
+
const hasError = (0, import_type_guards49.isNotNil)(computedError);
|
|
15356
|
+
const shouldRenderLabelDescriptionWrapper = !isIntegratedLabel || hasDescription;
|
|
15330
15357
|
let childProps = {
|
|
15331
15358
|
name,
|
|
15332
15359
|
id: computedId,
|
|
15333
15360
|
label: isIntegratedLabel ? label : void 0,
|
|
15334
15361
|
"aria-describedby": ariaDescribedby,
|
|
15335
|
-
"aria-invalid":
|
|
15362
|
+
"aria-invalid": hasError,
|
|
15363
|
+
style: { gridArea: "input" },
|
|
15336
15364
|
...props
|
|
15337
15365
|
};
|
|
15338
15366
|
if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
|
|
@@ -15362,28 +15390,38 @@ var FormField = ({
|
|
|
15362
15390
|
StyledFormField,
|
|
15363
15391
|
{
|
|
15364
15392
|
...props,
|
|
15393
|
+
$hasError: hasError,
|
|
15365
15394
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
15366
15395
|
children: [
|
|
15367
|
-
|
|
15368
|
-
|
|
15396
|
+
shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
|
|
15397
|
+
Stack,
|
|
15369
15398
|
{
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15399
|
+
direction: "vertical",
|
|
15400
|
+
gap: "space-01",
|
|
15401
|
+
style: {
|
|
15402
|
+
gridArea: "label-description"
|
|
15403
|
+
},
|
|
15404
|
+
children: [
|
|
15405
|
+
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15406
|
+
Label,
|
|
15407
|
+
{
|
|
15408
|
+
htmlFor: computedId,
|
|
15409
|
+
required,
|
|
15410
|
+
children: label
|
|
15411
|
+
}
|
|
15412
|
+
),
|
|
15413
|
+
hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null
|
|
15414
|
+
]
|
|
15373
15415
|
}
|
|
15374
|
-
),
|
|
15375
|
-
(0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
15416
|
+
) : null,
|
|
15376
15417
|
(0, import_react73.cloneElement)(children, childProps),
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
}
|
|
15385
|
-
)
|
|
15386
|
-
] }) : null
|
|
15418
|
+
hasError ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15419
|
+
ErrorMessages,
|
|
15420
|
+
{
|
|
15421
|
+
errors: computedError,
|
|
15422
|
+
id: errorId
|
|
15423
|
+
}
|
|
15424
|
+
) : null
|
|
15387
15425
|
]
|
|
15388
15426
|
}
|
|
15389
15427
|
);
|