@wistia/ui 0.18.10-beta.61e9f9ba.0b7ff11 → 0.18.10-beta.621d1dd0.401dcf0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.18.10-beta.61e9f9ba.0b7ff11
3
+ * @license @wistia/ui v0.18.10-beta.621d1dd0.401dcf0
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -15146,20 +15146,8 @@ var import_react73 = require("react");
15146
15146
  var import_styled_components86 = require("styled-components");
15147
15147
  var import_type_guards49 = require("@wistia/type-guards");
15148
15148
  var import_jsx_runtime288 = require("react/jsx-runtime");
15149
- var inlineErrorStyles = import_styled_components86.css`
15150
- grid-template-rows: 1fr auto;
15151
- grid-template-areas: 'label-description input' '. error';
15152
- `;
15153
- var inlineBaseGridAreaStyles = import_styled_components86.css`
15154
- grid-template-rows: 1fr;
15155
- grid-template-areas: 'label-description input';
15156
- `;
15157
- var blockGridErrorStyles = import_styled_components86.css`
15158
- grid-template-rows: auto 1fr auto;
15159
- grid-template-areas: 'label-description' 'input' 'error';
15160
- `;
15161
15149
  var StyledFormField = import_styled_components86.styled.div`
15162
- --form-field-spacing: var(--wui-space-02);
15150
+ --form-field-spacing: var(--wui-space-01);
15163
15151
  --form-field-spacing-inline: var(--wui-space-02);
15164
15152
  --form-field-error-color: var(--wui-color-text-secondary-error);
15165
15153
 
@@ -15173,28 +15161,21 @@ var StyledFormField = import_styled_components86.styled.div`
15173
15161
  &[data-label-position='inline-compact'] {
15174
15162
  gap: var(--form-field-spacing-inline);
15175
15163
  grid-template-columns: auto 1fr;
15176
- ${inlineBaseGridAreaStyles}
15177
- ${({ $hasError }) => $hasError && inlineErrorStyles}
15164
+ grid-template-rows: 1fr auto;
15178
15165
  }
15179
15166
 
15180
15167
  &[data-label-position='inline'] {
15181
15168
  gap: var(--form-field-spacing-inline);
15182
15169
  grid-template-columns: minmax(auto, 1fr) 1fr;
15183
- ${inlineBaseGridAreaStyles}
15184
- ${({ $hasError }) => $hasError && inlineErrorStyles}
15170
+ grid-template-rows: 1fr auto;
15185
15171
  }
15186
15172
 
15187
15173
  &[data-label-position='block'] {
15188
15174
  gap: var(--form-field-spacing);
15189
15175
  grid-template-columns: 1fr;
15190
- grid-template-rows: auto 1fr;
15191
- grid-template-areas: 'label-description' 'input';
15192
- ${({ $hasError }) => $hasError && blockGridErrorStyles}
15176
+ grid-template-rows: 1fr;
15193
15177
  }
15194
15178
  `;
15195
- var ErrorText = (0, import_styled_components86.styled)(Text)`
15196
- grid-area: error;
15197
- `;
15198
15179
  var StyledErrorList = import_styled_components86.styled.ul`
15199
15180
  margin: 0;
15200
15181
  padding: 0;
@@ -15202,14 +15183,13 @@ var StyledErrorList = import_styled_components86.styled.ul`
15202
15183
  display: flex;
15203
15184
  flex-direction: column;
15204
15185
  gap: var(--wui-space-01);
15205
- grid-area: error;
15206
15186
  `;
15207
15187
  var ErrorMessages = ({ errors, id }) => {
15208
15188
  const isErrorArray = (0, import_type_guards49.isArray)(errors);
15209
15189
  const isMultipleErrors = isErrorArray && errors.length > 1;
15210
15190
  if (!isErrorArray) {
15211
15191
  return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15212
- ErrorText,
15192
+ Text,
15213
15193
  {
15214
15194
  colorScheme: "error",
15215
15195
  id,
@@ -15222,7 +15202,7 @@ var ErrorMessages = ({ errors, id }) => {
15222
15202
  }
15223
15203
  if (!isMultipleErrors) {
15224
15204
  return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15225
- ErrorText,
15205
+ Text,
15226
15206
  {
15227
15207
  colorScheme: "error",
15228
15208
  id,
@@ -15267,16 +15247,12 @@ var FormField = ({
15267
15247
  const descriptionId = `${computedId}-description`;
15268
15248
  const errorId = `${computedId}-error`;
15269
15249
  const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
15270
- const hasDescription = (0, import_type_guards49.isNotNil)(description);
15271
- const hasError = (0, import_type_guards49.isNotNil)(computedError);
15272
- const shouldRenderLabelDescriptionWrapper = !isIntegratedLabel || hasDescription;
15273
15250
  let childProps = {
15274
15251
  name,
15275
15252
  id: computedId,
15276
15253
  label: isIntegratedLabel ? label : void 0,
15277
15254
  "aria-describedby": ariaDescribedby,
15278
- "aria-invalid": hasError,
15279
- style: { gridArea: "input" },
15255
+ "aria-invalid": (0, import_type_guards49.isNotNil)(computedError),
15280
15256
  ...props
15281
15257
  };
15282
15258
  if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
@@ -15306,38 +15282,28 @@ var FormField = ({
15306
15282
  StyledFormField,
15307
15283
  {
15308
15284
  ...props,
15309
- $hasError: hasError,
15310
15285
  "data-label-position": labelPosition ?? formState.labelPosition,
15311
15286
  children: [
15312
- shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(
15313
- Stack,
15287
+ !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15288
+ Label,
15314
15289
  {
15315
- direction: "vertical",
15316
- gap: "space-01",
15317
- style: {
15318
- gridArea: "label-description"
15319
- },
15320
- children: [
15321
- !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15322
- Label,
15323
- {
15324
- htmlFor: computedId,
15325
- required,
15326
- children: label
15327
- }
15328
- ),
15329
- hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null
15330
- ]
15290
+ htmlFor: computedId,
15291
+ required,
15292
+ children: label
15331
15293
  }
15332
- ) : null,
15294
+ ),
15295
+ (0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
15333
15296
  (0, import_react73.cloneElement)(children, childProps),
15334
- hasError ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15335
- ErrorMessages,
15336
- {
15337
- errors: computedError,
15338
- id: errorId
15339
- }
15340
- ) : null
15297
+ (0, import_type_guards49.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(import_jsx_runtime288.Fragment, { children: [
15298
+ /* @__PURE__ */ (0, import_jsx_runtime288.jsx)("div", {}),
15299
+ /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15300
+ ErrorMessages,
15301
+ {
15302
+ errors: computedError,
15303
+ id: errorId
15304
+ }
15305
+ )
15306
+ ] }) : null
15341
15307
  ]
15342
15308
  }
15343
15309
  );