@wistia/ui 0.18.18-beta.f646dff0.af8ca00 → 0.18.18-beta.fba14250.ac46dfb
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 +43 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.mjs +106 -127
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.18.18-beta.
|
|
3
|
+
* @license @wistia/ui v0.18.18-beta.fba14250.ac46dfb
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -14252,7 +14252,7 @@ var DataCardInner = ({
|
|
|
14252
14252
|
StyledLabel3,
|
|
14253
14253
|
{
|
|
14254
14254
|
"data-wui-data-card-skeleton": isLoading,
|
|
14255
|
-
renderAs: "
|
|
14255
|
+
renderAs: "span",
|
|
14256
14256
|
variant: "heading6",
|
|
14257
14257
|
children: label
|
|
14258
14258
|
}
|
|
@@ -14261,7 +14261,7 @@ var DataCardInner = ({
|
|
|
14261
14261
|
StyledValue,
|
|
14262
14262
|
{
|
|
14263
14263
|
"data-wui-data-card-skeleton": isLoading,
|
|
14264
|
-
renderAs: "
|
|
14264
|
+
renderAs: "span",
|
|
14265
14265
|
variant: "heading3",
|
|
14266
14266
|
children: value
|
|
14267
14267
|
}
|
|
@@ -14314,29 +14314,42 @@ var import_styled_components78 = require("styled-components");
|
|
|
14314
14314
|
var import_jsx_runtime279 = require("react/jsx-runtime");
|
|
14315
14315
|
var StyledDataCards = (0, import_styled_components78.styled)(Box)`
|
|
14316
14316
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
14317
|
+
--wui-data-cards-column-count: ${({ $columns }) => $columns === "auto" ? void 0 : $columns};
|
|
14318
|
+
--wui-data-cards-total-column-gap-width: calc(var(--wui-data-cards-column-count) - 1) *
|
|
14319
|
+
var(--wui-space-02);
|
|
14320
|
+
--wui-data-cards-column-width: calc(
|
|
14321
|
+
(100% - var(--wui-data-cards-total-column-gap-width)) / var(--wui-data-cards-column-count)
|
|
14322
|
+
);
|
|
14317
14323
|
|
|
14318
14324
|
> * {
|
|
14319
|
-
min-width:
|
|
14325
|
+
min-width: ${({ $cardMinWidth }) => $cardMinWidth};
|
|
14326
|
+
flex-basis: var(--wui-data-cards-column-width, 0);
|
|
14320
14327
|
max-width: ${({ $cardMaxWidth }) => $cardMaxWidth};
|
|
14321
14328
|
}
|
|
14322
14329
|
`;
|
|
14323
14330
|
var DataCards = ({
|
|
14324
14331
|
children,
|
|
14332
|
+
cardMinWidth = "120px",
|
|
14325
14333
|
cardMaxWidth = "none",
|
|
14326
14334
|
colorScheme = "inherit",
|
|
14335
|
+
columns = "auto",
|
|
14327
14336
|
...props
|
|
14328
14337
|
}) => {
|
|
14338
|
+
const responsiveCardMinWidth = useResponsiveProp(cardMinWidth);
|
|
14339
|
+
const responsiveCardMaxWidth = useResponsiveProp(cardMaxWidth);
|
|
14340
|
+
const responsiveColumns = useResponsiveProp(columns);
|
|
14329
14341
|
return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
|
|
14330
14342
|
StyledDataCards,
|
|
14331
14343
|
{
|
|
14332
14344
|
...props,
|
|
14333
|
-
$cardMaxWidth:
|
|
14345
|
+
$cardMaxWidth: responsiveCardMaxWidth,
|
|
14346
|
+
$cardMinWidth: responsiveCardMinWidth,
|
|
14334
14347
|
$colorScheme: colorScheme,
|
|
14348
|
+
$columns: responsiveColumns,
|
|
14335
14349
|
alignItems: "stretch",
|
|
14336
14350
|
direction: "row",
|
|
14337
14351
|
fill: "horizontal",
|
|
14338
14352
|
gap: "space-02",
|
|
14339
|
-
renderAs: "dl",
|
|
14340
14353
|
wrapItems: true,
|
|
14341
14354
|
children
|
|
14342
14355
|
}
|
|
@@ -15230,20 +15243,8 @@ var import_react73 = require("react");
|
|
|
15230
15243
|
var import_styled_components87 = require("styled-components");
|
|
15231
15244
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
15232
15245
|
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
|
-
`;
|
|
15245
15246
|
var StyledFormField = import_styled_components87.styled.div`
|
|
15246
|
-
--form-field-spacing: var(--wui-space-
|
|
15247
|
+
--form-field-spacing: var(--wui-space-01);
|
|
15247
15248
|
--form-field-spacing-inline: var(--wui-space-02);
|
|
15248
15249
|
--form-field-error-color: var(--wui-color-text-secondary-error);
|
|
15249
15250
|
|
|
@@ -15257,28 +15258,21 @@ var StyledFormField = import_styled_components87.styled.div`
|
|
|
15257
15258
|
&[data-label-position='inline-compact'] {
|
|
15258
15259
|
gap: var(--form-field-spacing-inline);
|
|
15259
15260
|
grid-template-columns: auto 1fr;
|
|
15260
|
-
|
|
15261
|
-
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15261
|
+
grid-template-rows: 1fr auto;
|
|
15262
15262
|
}
|
|
15263
15263
|
|
|
15264
15264
|
&[data-label-position='inline'] {
|
|
15265
15265
|
gap: var(--form-field-spacing-inline);
|
|
15266
15266
|
grid-template-columns: minmax(auto, 1fr) 1fr;
|
|
15267
|
-
|
|
15268
|
-
${({ $hasError }) => $hasError && inlineErrorStyles}
|
|
15267
|
+
grid-template-rows: 1fr auto;
|
|
15269
15268
|
}
|
|
15270
15269
|
|
|
15271
15270
|
&[data-label-position='block'] {
|
|
15272
15271
|
gap: var(--form-field-spacing);
|
|
15273
15272
|
grid-template-columns: 1fr;
|
|
15274
|
-
grid-template-rows:
|
|
15275
|
-
grid-template-areas: 'label-description' 'input';
|
|
15276
|
-
${({ $hasError }) => $hasError && blockGridErrorStyles}
|
|
15273
|
+
grid-template-rows: 1fr;
|
|
15277
15274
|
}
|
|
15278
15275
|
`;
|
|
15279
|
-
var ErrorText = (0, import_styled_components87.styled)(Text)`
|
|
15280
|
-
grid-area: error;
|
|
15281
|
-
`;
|
|
15282
15276
|
var StyledErrorList = import_styled_components87.styled.ul`
|
|
15283
15277
|
margin: 0;
|
|
15284
15278
|
padding: 0;
|
|
@@ -15286,14 +15280,13 @@ var StyledErrorList = import_styled_components87.styled.ul`
|
|
|
15286
15280
|
display: flex;
|
|
15287
15281
|
flex-direction: column;
|
|
15288
15282
|
gap: var(--wui-space-01);
|
|
15289
|
-
grid-area: error;
|
|
15290
15283
|
`;
|
|
15291
15284
|
var ErrorMessages = ({ errors, id }) => {
|
|
15292
15285
|
const isErrorArray = (0, import_type_guards49.isArray)(errors);
|
|
15293
15286
|
const isMultipleErrors = isErrorArray && errors.length > 1;
|
|
15294
15287
|
if (!isErrorArray) {
|
|
15295
15288
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15296
|
-
|
|
15289
|
+
Text,
|
|
15297
15290
|
{
|
|
15298
15291
|
colorScheme: "error",
|
|
15299
15292
|
id,
|
|
@@ -15306,7 +15299,7 @@ var ErrorMessages = ({ errors, id }) => {
|
|
|
15306
15299
|
}
|
|
15307
15300
|
if (!isMultipleErrors) {
|
|
15308
15301
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15309
|
-
|
|
15302
|
+
Text,
|
|
15310
15303
|
{
|
|
15311
15304
|
colorScheme: "error",
|
|
15312
15305
|
id,
|
|
@@ -15351,16 +15344,12 @@ var FormField = ({
|
|
|
15351
15344
|
const descriptionId = `${computedId}-description`;
|
|
15352
15345
|
const errorId = `${computedId}-error`;
|
|
15353
15346
|
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;
|
|
15357
15347
|
let childProps = {
|
|
15358
15348
|
name,
|
|
15359
15349
|
id: computedId,
|
|
15360
15350
|
label: isIntegratedLabel ? label : void 0,
|
|
15361
15351
|
"aria-describedby": ariaDescribedby,
|
|
15362
|
-
"aria-invalid":
|
|
15363
|
-
style: { gridArea: "input" },
|
|
15352
|
+
"aria-invalid": (0, import_type_guards49.isNotNil)(computedError),
|
|
15364
15353
|
...props
|
|
15365
15354
|
};
|
|
15366
15355
|
if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
|
|
@@ -15390,38 +15379,28 @@ var FormField = ({
|
|
|
15390
15379
|
StyledFormField,
|
|
15391
15380
|
{
|
|
15392
15381
|
...props,
|
|
15393
|
-
$hasError: hasError,
|
|
15394
15382
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
15395
15383
|
children: [
|
|
15396
|
-
|
|
15397
|
-
|
|
15384
|
+
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15385
|
+
Label,
|
|
15398
15386
|
{
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
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
|
-
]
|
|
15387
|
+
htmlFor: computedId,
|
|
15388
|
+
required,
|
|
15389
|
+
children: label
|
|
15415
15390
|
}
|
|
15416
|
-
)
|
|
15391
|
+
),
|
|
15392
|
+
(0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
15417
15393
|
(0, import_react73.cloneElement)(children, childProps),
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15394
|
+
(0, import_type_guards49.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_jsx_runtime293.Fragment, { children: [
|
|
15395
|
+
/* @__PURE__ */ (0, import_jsx_runtime293.jsx)("div", {}),
|
|
15396
|
+
/* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
|
|
15397
|
+
ErrorMessages,
|
|
15398
|
+
{
|
|
15399
|
+
errors: computedError,
|
|
15400
|
+
id: errorId
|
|
15401
|
+
}
|
|
15402
|
+
)
|
|
15403
|
+
] }) : null
|
|
15425
15404
|
]
|
|
15426
15405
|
}
|
|
15427
15406
|
);
|