@wistia/ui 0.18.17-beta.c1f00b80.e6809d4 → 0.18.18-beta.d3fdc545.1470a35
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 +61 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +124 -89
- 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.d3fdc545.1470a35
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -14159,7 +14159,6 @@ var StyledDataCard = import_styled_components77.styled.div`
|
|
|
14159
14159
|
animation: ${pulse} 1.5s var(--wui-motion-ease-in-out) 0.5s infinite;
|
|
14160
14160
|
color: transparent;
|
|
14161
14161
|
user-select: none;
|
|
14162
|
-
pointer-events: none;
|
|
14163
14162
|
border-radius: var(--wui-border-radius-01);
|
|
14164
14163
|
width: fit-content;
|
|
14165
14164
|
}
|
|
@@ -14208,12 +14207,14 @@ var StyledDataCard = import_styled_components77.styled.div`
|
|
|
14208
14207
|
`;
|
|
14209
14208
|
var StyledLabel3 = (0, import_styled_components77.styled)(Heading)`
|
|
14210
14209
|
grid-area: label;
|
|
14210
|
+
|
|
14211
14211
|
&[data-wui-data-card-skeleton='true'] {
|
|
14212
14212
|
width: 80px;
|
|
14213
14213
|
}
|
|
14214
14214
|
`;
|
|
14215
14215
|
var StyledValue = (0, import_styled_components77.styled)(Heading)`
|
|
14216
14216
|
grid-area: value;
|
|
14217
|
+
|
|
14217
14218
|
&[data-wui-data-card-skeleton='true'] {
|
|
14218
14219
|
width: min(90%, 156px);
|
|
14219
14220
|
}
|
|
@@ -15229,8 +15230,20 @@ var import_react73 = require("react");
|
|
|
15229
15230
|
var import_styled_components87 = require("styled-components");
|
|
15230
15231
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
15231
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
|
+
`;
|
|
15232
15245
|
var StyledFormField = import_styled_components87.styled.div`
|
|
15233
|
-
--form-field-spacing: var(--wui-space-
|
|
15246
|
+
--form-field-spacing: var(--wui-space-02);
|
|
15234
15247
|
--form-field-spacing-inline: var(--wui-space-02);
|
|
15235
15248
|
--form-field-error-color: var(--wui-color-text-secondary-error);
|
|
15236
15249
|
|
|
@@ -15244,21 +15257,28 @@ var StyledFormField = import_styled_components87.styled.div`
|
|
|
15244
15257
|
&[data-label-position='inline-compact'] {
|
|
15245
15258
|
gap: var(--form-field-spacing-inline);
|
|
15246
15259
|
grid-template-columns: auto 1fr;
|
|
15247
|
-
|
|
15260
|
+
${inlineBaseGridAreaStyles}
|
|
15261
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15248
15262
|
}
|
|
15249
15263
|
|
|
15250
15264
|
&[data-label-position='inline'] {
|
|
15251
15265
|
gap: var(--form-field-spacing-inline);
|
|
15252
15266
|
grid-template-columns: minmax(auto, 1fr) 1fr;
|
|
15253
|
-
|
|
15267
|
+
${inlineBaseGridAreaStyles}
|
|
15268
|
+
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15254
15269
|
}
|
|
15255
15270
|
|
|
15256
15271
|
&[data-label-position='block'] {
|
|
15257
15272
|
gap: var(--form-field-spacing);
|
|
15258
15273
|
grid-template-columns: 1fr;
|
|
15259
|
-
grid-template-rows: 1fr;
|
|
15274
|
+
grid-template-rows: auto 1fr;
|
|
15275
|
+
grid-template-areas: 'label-description' 'input';
|
|
15276
|
+
${({ $hasError }) => $hasError && blockGridErrorStyles}
|
|
15260
15277
|
}
|
|
15261
15278
|
`;
|
|
15279
|
+
var ErrorText = (0, import_styled_components87.styled)(Text)`
|
|
15280
|
+
grid-area: error;
|
|
15281
|
+
`;
|
|
15262
15282
|
var StyledErrorList = import_styled_components87.styled.ul`
|
|
15263
15283
|
margin: 0;
|
|
15264
15284
|
padding: 0;
|
|
@@ -15266,13 +15286,14 @@ var StyledErrorList = import_styled_components87.styled.ul`
|
|
|
15266
15286
|
display: flex;
|
|
15267
15287
|
flex-direction: column;
|
|
15268
15288
|
gap: var(--wui-space-01);
|
|
15289
|
+
grid-area: error;
|
|
15269
15290
|
`;
|
|
15270
15291
|
var ErrorMessages = ({ errors, id }) => {
|
|
15271
15292
|
const isErrorArray = (0, import_type_guards49.isArray)(errors);
|
|
15272
15293
|
const isMultipleErrors = isErrorArray && errors.length > 1;
|
|
15273
15294
|
if (!isErrorArray) {
|
|
15274
15295
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15275
|
-
|
|
15296
|
+
ErrorText,
|
|
15276
15297
|
{
|
|
15277
15298
|
colorScheme: "error",
|
|
15278
15299
|
id,
|
|
@@ -15285,7 +15306,7 @@ var ErrorMessages = ({ errors, id }) => {
|
|
|
15285
15306
|
}
|
|
15286
15307
|
if (!isMultipleErrors) {
|
|
15287
15308
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15288
|
-
|
|
15309
|
+
ErrorText,
|
|
15289
15310
|
{
|
|
15290
15311
|
colorScheme: "error",
|
|
15291
15312
|
id,
|
|
@@ -15330,12 +15351,16 @@ var FormField = ({
|
|
|
15330
15351
|
const descriptionId = `${computedId}-description`;
|
|
15331
15352
|
const errorId = `${computedId}-error`;
|
|
15332
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;
|
|
15333
15357
|
let childProps = {
|
|
15334
15358
|
name,
|
|
15335
15359
|
id: computedId,
|
|
15336
15360
|
label: isIntegratedLabel ? label : void 0,
|
|
15337
15361
|
"aria-describedby": ariaDescribedby,
|
|
15338
|
-
"aria-invalid":
|
|
15362
|
+
"aria-invalid": hasError,
|
|
15363
|
+
style: { gridArea: "input" },
|
|
15339
15364
|
...props
|
|
15340
15365
|
};
|
|
15341
15366
|
if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
|
|
@@ -15365,28 +15390,38 @@ var FormField = ({
|
|
|
15365
15390
|
StyledFormField,
|
|
15366
15391
|
{
|
|
15367
15392
|
...props,
|
|
15393
|
+
$hasError: hasError,
|
|
15368
15394
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
15369
15395
|
children: [
|
|
15370
|
-
|
|
15371
|
-
|
|
15396
|
+
shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
|
|
15397
|
+
Stack,
|
|
15372
15398
|
{
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
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
|
+
]
|
|
15376
15415
|
}
|
|
15377
|
-
),
|
|
15378
|
-
(0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
15416
|
+
) : null,
|
|
15379
15417
|
(0, import_react73.cloneElement)(children, childProps),
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
}
|
|
15388
|
-
)
|
|
15389
|
-
] }) : null
|
|
15418
|
+
hasError ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15419
|
+
ErrorMessages,
|
|
15420
|
+
{
|
|
15421
|
+
errors: computedError,
|
|
15422
|
+
id: errorId
|
|
15423
|
+
}
|
|
15424
|
+
) : null
|
|
15390
15425
|
]
|
|
15391
15426
|
}
|
|
15392
15427
|
);
|