@wistia/ui 0.6.0-beta.cfc2a53c.6423353 → 0.6.1
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 +72 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +49 -124
- package/dist/index.d.ts +49 -124
- package/dist/index.mjs +76 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -21
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.6.
|
|
3
|
+
* @license @wistia/ui v0.6.1
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -68,6 +68,7 @@ __export(index_exports, {
|
|
|
68
68
|
Heading: () => Heading,
|
|
69
69
|
Icon: () => Icon,
|
|
70
70
|
IconButton: () => IconButton,
|
|
71
|
+
Image: () => Image,
|
|
71
72
|
Input: () => Input,
|
|
72
73
|
Label: () => Label,
|
|
73
74
|
Link: () => Link,
|
|
@@ -8135,18 +8136,9 @@ var FormContext = (0, import_react25.createContext)({
|
|
|
8135
8136
|
values: {},
|
|
8136
8137
|
errors: {},
|
|
8137
8138
|
hasSubmitted: false,
|
|
8138
|
-
formId: ""
|
|
8139
|
-
appearance: "block"
|
|
8139
|
+
formId: ""
|
|
8140
8140
|
});
|
|
8141
|
-
var FormComponent = ({
|
|
8142
|
-
children,
|
|
8143
|
-
action,
|
|
8144
|
-
values = {},
|
|
8145
|
-
appearance = "block",
|
|
8146
|
-
validate,
|
|
8147
|
-
fullWidth = false,
|
|
8148
|
-
...props
|
|
8149
|
-
}, forwardedRef) => {
|
|
8141
|
+
var FormComponent = ({ children, action, values = {}, validate, fullWidth = false, ...props }, forwardedRef) => {
|
|
8150
8142
|
const [errors, setErrors] = (0, import_react25.useState)({});
|
|
8151
8143
|
const [hasSubmitted, setHasSubmitted] = (0, import_react25.useState)(false);
|
|
8152
8144
|
const innerRef = (0, import_react25.useRef)();
|
|
@@ -8198,20 +8190,19 @@ var FormComponent = ({
|
|
|
8198
8190
|
values,
|
|
8199
8191
|
errors,
|
|
8200
8192
|
hasSubmitted,
|
|
8201
|
-
formId: id
|
|
8202
|
-
appearance
|
|
8193
|
+
formId: id
|
|
8203
8194
|
};
|
|
8204
|
-
}, [
|
|
8195
|
+
}, [values, errors, id, hasSubmitted]);
|
|
8205
8196
|
return (
|
|
8206
8197
|
// @ts-expect-error - generic context providers are a giant pain
|
|
8207
8198
|
/* @__PURE__ */ (0, import_jsx_runtime189.jsx)(FormContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
|
|
8208
8199
|
Stack,
|
|
8209
8200
|
{
|
|
8201
|
+
gap: "space-05",
|
|
8210
8202
|
...props,
|
|
8211
8203
|
ref,
|
|
8212
8204
|
$fullWidth: fullWidth,
|
|
8213
8205
|
as: StyledForm,
|
|
8214
|
-
gap: "space-05",
|
|
8215
8206
|
id,
|
|
8216
8207
|
onBlur: handleBlur,
|
|
8217
8208
|
onReset: handleReset,
|
|
@@ -8364,27 +8355,11 @@ CheckboxGroup.displayName = "CheckboxGroup";
|
|
|
8364
8355
|
var import_jsx_runtime193 = require("react/jsx-runtime");
|
|
8365
8356
|
var StyledFormField = import_styled_components48.default.div`
|
|
8366
8357
|
--form-field-spacing: var(--wui-space-01);
|
|
8367
|
-
--form-field-spacing-inline: var(--wui-space-02);
|
|
8368
8358
|
--form-field-error-color: var(--wui-color-text-secondary-error);
|
|
8369
8359
|
|
|
8370
|
-
display:
|
|
8360
|
+
display: flex;
|
|
8361
|
+
flex-direction: column;
|
|
8371
8362
|
gap: var(--form-field-spacing);
|
|
8372
|
-
justify-content: flex-start;
|
|
8373
|
-
align-items: center;
|
|
8374
|
-
grid-template-columns: auto 1fr;
|
|
8375
|
-
grid-template-rows: auto 1fr;
|
|
8376
|
-
|
|
8377
|
-
&[data-appearance='inline'] {
|
|
8378
|
-
gap: var(--form-field-spacing-inline);
|
|
8379
|
-
grid-template-columns: auto 1fr;
|
|
8380
|
-
grid-template-rows: auto 1fr;
|
|
8381
|
-
}
|
|
8382
|
-
|
|
8383
|
-
&[data-appearance='block'] {
|
|
8384
|
-
gap: var(--form-field-spacing);
|
|
8385
|
-
grid-template-columns: 1fr;
|
|
8386
|
-
grid-template-rows: 1fr;
|
|
8387
|
-
}
|
|
8388
8363
|
`;
|
|
8389
8364
|
var StyledErrorList = import_styled_components48.default.ul`
|
|
8390
8365
|
margin: 0;
|
|
@@ -8424,19 +8399,18 @@ var FormField = ({
|
|
|
8424
8399
|
name,
|
|
8425
8400
|
error,
|
|
8426
8401
|
value,
|
|
8427
|
-
appearance,
|
|
8428
8402
|
...props
|
|
8429
8403
|
}) => {
|
|
8430
8404
|
const formState = (0, import_react30.useContext)(FormContext);
|
|
8431
8405
|
const checkboxGroup = (0, import_react30.useContext)(CheckboxGroupContext);
|
|
8432
8406
|
const id = props.id ?? `${formState.formId}-${name}`;
|
|
8433
|
-
const
|
|
8407
|
+
const isInlineLabel = children.type === Checkbox;
|
|
8434
8408
|
const computedError = error ?? formState.errors[name];
|
|
8435
8409
|
const defaultValue = formState.values[name];
|
|
8436
8410
|
let childProps = {
|
|
8437
8411
|
name,
|
|
8438
8412
|
id,
|
|
8439
|
-
label:
|
|
8413
|
+
label: isInlineLabel ? label : void 0,
|
|
8440
8414
|
...props
|
|
8441
8415
|
};
|
|
8442
8416
|
if ((0, import_type_guards28.isUndefined)(value) && (0, import_type_guards28.isNotUndefined)(defaultValue)) {
|
|
@@ -8463,30 +8437,18 @@ var FormField = ({
|
|
|
8463
8437
|
"aria-describedby": (0, import_type_guards28.isNotNil)(error) ? `${id}-error` : void 0
|
|
8464
8438
|
};
|
|
8465
8439
|
}
|
|
8466
|
-
const computedApperance = appearance ?? formState.appearance;
|
|
8467
|
-
console.log(appearance, formState.appearance);
|
|
8468
8440
|
import_react30.Children.only(children);
|
|
8469
|
-
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
ErrorMessages,
|
|
8481
|
-
{
|
|
8482
|
-
errors: computedError,
|
|
8483
|
-
id: `${id}-error`
|
|
8484
|
-
}
|
|
8485
|
-
)
|
|
8486
|
-
] }) : null
|
|
8487
|
-
]
|
|
8488
|
-
}
|
|
8489
|
-
);
|
|
8441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(StyledFormField, { ...props, children: [
|
|
8442
|
+
!isInlineLabel && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(Label, { htmlFor: id, children: label }),
|
|
8443
|
+
(0, import_react30.cloneElement)(children, childProps),
|
|
8444
|
+
(0, import_type_guards28.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
8445
|
+
ErrorMessages,
|
|
8446
|
+
{
|
|
8447
|
+
errors: computedError,
|
|
8448
|
+
id: `${id}-error`
|
|
8449
|
+
}
|
|
8450
|
+
) : null
|
|
8451
|
+
] });
|
|
8490
8452
|
};
|
|
8491
8453
|
FormField.displayName = "FormField";
|
|
8492
8454
|
|
|
@@ -10442,7 +10404,6 @@ var StyledContent3 = (0, import_styled_components71.default)(import_react_select
|
|
|
10442
10404
|
border-radius: var(--wui-select-content-border-radius);
|
|
10443
10405
|
padding: var(--wui-select-option-padding);
|
|
10444
10406
|
min-width: 200px;
|
|
10445
|
-
z-index: var(--wui-zindex-menu);
|
|
10446
10407
|
`;
|
|
10447
10408
|
var Select = (0, import_react55.forwardRef)(
|
|
10448
10409
|
({
|
|
@@ -10565,6 +10526,55 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
10565
10526
|
children
|
|
10566
10527
|
] });
|
|
10567
10528
|
};
|
|
10529
|
+
|
|
10530
|
+
// src/components/Image/Image.tsx
|
|
10531
|
+
var import_styled_components74 = __toESM(require("styled-components"));
|
|
10532
|
+
var import_type_guards43 = require("@wistia/type-guards");
|
|
10533
|
+
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
10534
|
+
var getFillStyle2 = (fillContainer) => {
|
|
10535
|
+
if (fillContainer === "horizontal") {
|
|
10536
|
+
return "width: 100%;";
|
|
10537
|
+
}
|
|
10538
|
+
if (fillContainer === "vertical") {
|
|
10539
|
+
return "height: 100%;";
|
|
10540
|
+
}
|
|
10541
|
+
if (fillContainer === true) {
|
|
10542
|
+
return `
|
|
10543
|
+
width: 100%;
|
|
10544
|
+
height: 100%;
|
|
10545
|
+
`;
|
|
10546
|
+
}
|
|
10547
|
+
return void 0;
|
|
10548
|
+
};
|
|
10549
|
+
var StyledImage = import_styled_components74.default.img`
|
|
10550
|
+
border-radius: ${({ $borderRadius }) => (0, import_type_guards43.isNotNil)($borderRadius) ? `var(--wui-${$borderRadius})` : void 0};
|
|
10551
|
+
${({ $fillContainer }) => getFillStyle2($fillContainer)};
|
|
10552
|
+
object-fit: ${({ $objFit }) => $objFit};
|
|
10553
|
+
object-position: ${({ $objPosition }) => $objPosition};
|
|
10554
|
+
`;
|
|
10555
|
+
var Image = ({
|
|
10556
|
+
src,
|
|
10557
|
+
alt,
|
|
10558
|
+
borderRadius,
|
|
10559
|
+
fill: fillContainer = false,
|
|
10560
|
+
fit: objFit,
|
|
10561
|
+
loading = "lazy",
|
|
10562
|
+
position: objPosition,
|
|
10563
|
+
...otherProps
|
|
10564
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
10565
|
+
StyledImage,
|
|
10566
|
+
{
|
|
10567
|
+
$borderRadius: borderRadius,
|
|
10568
|
+
$fillContainer: fillContainer,
|
|
10569
|
+
$objFit: objFit,
|
|
10570
|
+
$objPosition: objPosition,
|
|
10571
|
+
alt,
|
|
10572
|
+
loading,
|
|
10573
|
+
src,
|
|
10574
|
+
...otherProps
|
|
10575
|
+
}
|
|
10576
|
+
);
|
|
10577
|
+
Image.displayName = "Image";
|
|
10568
10578
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10569
10579
|
0 && (module.exports = {
|
|
10570
10580
|
ActionButton,
|
|
@@ -10596,6 +10606,7 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
10596
10606
|
Heading,
|
|
10597
10607
|
Icon,
|
|
10598
10608
|
IconButton,
|
|
10609
|
+
Image,
|
|
10599
10610
|
Input,
|
|
10600
10611
|
Label,
|
|
10601
10612
|
Link,
|