@wistia/ui 0.6.1 → 0.6.2-beta.be728696.d49d6eb

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.6.1
3
+ * @license @wistia/ui v0.6.2-beta.be728696.d49d6eb
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2283,45 +2283,55 @@ var defaultScheme = import_styled_components14.css`
2283
2283
  --wui-color-focus-ring: var(--wui-blue-9);
2284
2284
  `;
2285
2285
  var navScheme = import_styled_components14.css`
2286
- --wui-color-bg-fill-active: var(--wui-blue-5);
2287
- --wui-color-bg-fill-hover: var(--wui-blue-4);
2286
+ --wui-color-bg-app: #1e3399;
2287
+
2288
2288
  --wui-color-bg-fill: var(--wui-blue-1);
2289
- --wui-color-bg-surface-active: #15246b;
2290
- --wui-color-bg-surface-hover: #18297a;
2291
- --wui-color-bg-surface-secondary-active: #121f5c;
2292
- --wui-color-bg-surface-secondary-hover: #15246b;
2293
- --wui-color-bg-surface-secondary: #18297a;
2294
- --wui-color-bg-surface-tertiary: #3547a3;
2295
- --wui-color-bg-surface: #1e3399;
2296
- --wui-color-border: var(--wui-blue-1);
2297
- --wui-color-border-hover: var(--wui-blue-2);
2298
- --wui-color-border-active: var(--wui-blue-3);
2299
- --wui-color-border-secondary: var(--wui-blue-9);
2300
- --wui-color-border-secondary-hover: var(--wui-blue-10);
2301
- --wui-color-border-secondary-active: var(--wui-blue-12);
2302
- --wui-color-icon-on-fill: var(--wui-blue-9);
2303
- --wui-color-icon: var(--wui-blue-4);
2304
- --wui-color-text-link: var(--wui-blue-4);
2305
- --wui-color-text-on-fill: var(--wui-blue-9);
2306
- --wui-color-text-secondary: var(--wui-blue-4);
2289
+ --wui-color-bg-fill-hover: #e7e9f4;
2290
+ --wui-color-bg-fill-active: #dcdfef;
2291
+
2292
+ --wui-color-bg-surface: transparent;
2293
+ --wui-color-bg-surface-hover: #15267b;
2294
+ --wui-color-bg-surface-active: #122271;
2295
+
2296
+ --wui-color-bg-surface-secondary: #15267b;
2297
+ --wui-color-bg-surface-secondary-hover: #122271;
2298
+ --wui-color-bg-surface-secondary-active: #101e67;
2299
+
2300
+ --wui-color-bg-surface-tertiary: #0d1a5c;
2301
+
2302
+ --wui-color-border: #101e67;
2303
+ --wui-color-border-hover: #0e1c61;
2304
+ --wui-color-border-active: #0d1a5c;
2305
+
2306
+ --wui-color-border-secondary: var(--wui-color-bg-fill);
2307
+ --wui-color-border-secondary-hover: var(--wui-color-bg-fill-hover);
2308
+ --wui-color-border-secondary-active: var(--wui-color-bg-fill-active);
2309
+
2310
+ --wui-color-icon: var(--wui-blue-1);
2311
+ --wui-color-icon-on-fill: var(--wui-color-bg-app);
2312
+
2307
2313
  --wui-color-text: var(--wui-blue-1);
2314
+ --wui-color-text-on-fill: var(--wui-color-bg-app);
2315
+ --wui-color-text-link: var(--wui-blue-4);
2316
+ --wui-color-text-secondary: var(--wui-blue-6);
2308
2317
  --wui-color-text-button: var(--wui-blue-1);
2318
+
2309
2319
  --wui-color-focus-ring: var(--wui-blue-1);
2310
2320
 
2311
2321
  /* Nav - Disabled */
2312
- --wui-color-bg-surface-disabled: var(--wui-blue-12);
2322
+ --wui-color-bg-surface-disabled: transparent;
2313
2323
  --wui-color-icon-disabled: var(--wui-blue-8);
2314
2324
  --wui-color-text-disabled: var(--wui-blue-8);
2315
2325
 
2316
2326
  /* Nav - Selected */
2317
- --wui-color-bg-surface-selected: var(--wui-blue-3);
2318
- --wui-color-bg-surface-selected-active: var(--wui-blue-5);
2319
- --wui-color-bg-surface-selected-hover: var(--wui-blue-4);
2320
- --wui-color-icon-selected: var(--wui-blue-9);
2321
- --wui-color-text-selected: var(--wui-blue-9);
2322
- --wui-color-border-selected: rgba(0, 0, 0, 0);
2323
- --wui-color-border-hover-selected: rgba(0, 0, 0, 0);
2324
- --wui-color-border-active-selected: rgba(0, 0, 0, 0);
2327
+ --wui-color-bg-surface-selected: var(--wui-color-bg-fill);
2328
+ --wui-color-bg-surface-selected-active: var(--wui-color-bg-fill-active);
2329
+ --wui-color-bg-surface-selected-hover: var(--wui-color-bg-fill-hover);
2330
+ --wui-color-icon-selected: var(--wui-color-bg-app);
2331
+ --wui-color-text-selected: var(--wui-color-bg-app);
2332
+ --wui-color-border-selected: transparent;
2333
+ --wui-color-border-hover-selected: transparent;
2334
+ --wui-color-border-active-selected: transparent;
2325
2335
  `;
2326
2336
  var getColorScheme = (colorScheme) => {
2327
2337
  if (colorScheme === "nav") {
@@ -8136,9 +8146,18 @@ var FormContext = (0, import_react25.createContext)({
8136
8146
  values: {},
8137
8147
  errors: {},
8138
8148
  hasSubmitted: false,
8139
- formId: ""
8149
+ formId: "",
8150
+ labelPosition: "block"
8140
8151
  });
8141
- var FormComponent = ({ children, action, values = {}, validate, fullWidth = false, ...props }, forwardedRef) => {
8152
+ var FormComponent = ({
8153
+ children,
8154
+ action,
8155
+ values = {},
8156
+ labelPosition = "block",
8157
+ validate,
8158
+ fullWidth = false,
8159
+ ...props
8160
+ }, forwardedRef) => {
8142
8161
  const [errors, setErrors] = (0, import_react25.useState)({});
8143
8162
  const [hasSubmitted, setHasSubmitted] = (0, import_react25.useState)(false);
8144
8163
  const innerRef = (0, import_react25.useRef)();
@@ -8190,19 +8209,20 @@ var FormComponent = ({ children, action, values = {}, validate, fullWidth = fals
8190
8209
  values,
8191
8210
  errors,
8192
8211
  hasSubmitted,
8193
- formId: id
8212
+ formId: id,
8213
+ labelPosition
8194
8214
  };
8195
- }, [values, errors, id, hasSubmitted]);
8215
+ }, [labelPosition, values, errors, id, hasSubmitted]);
8196
8216
  return (
8197
8217
  // @ts-expect-error - generic context providers are a giant pain
8198
8218
  /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(FormContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(
8199
8219
  Stack,
8200
8220
  {
8201
- gap: "space-05",
8202
8221
  ...props,
8203
8222
  ref,
8204
8223
  $fullWidth: fullWidth,
8205
8224
  as: StyledForm,
8225
+ gap: "space-05",
8206
8226
  id,
8207
8227
  onBlur: handleBlur,
8208
8228
  onReset: handleReset,
@@ -8256,7 +8276,7 @@ var import_react27 = require("react");
8256
8276
  var import_type_guards27 = require("@wistia/type-guards");
8257
8277
  var import_jsx_runtime190 = require("react/jsx-runtime");
8258
8278
  var ErrorItem = ({ name, error, formId }) => {
8259
- return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(Link, { href: `${formId}-${name}`, children: error }) }, name);
8279
+ return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
8260
8280
  };
8261
8281
  var FormErrorSummary = ({ description }) => {
8262
8282
  const ref = (0, import_react27.useRef)(null);
@@ -8355,11 +8375,27 @@ CheckboxGroup.displayName = "CheckboxGroup";
8355
8375
  var import_jsx_runtime193 = require("react/jsx-runtime");
8356
8376
  var StyledFormField = import_styled_components48.default.div`
8357
8377
  --form-field-spacing: var(--wui-space-01);
8378
+ --form-field-spacing-inline: var(--wui-space-02);
8358
8379
  --form-field-error-color: var(--wui-color-text-secondary-error);
8359
8380
 
8360
- display: flex;
8361
- flex-direction: column;
8381
+ display: grid;
8362
8382
  gap: var(--form-field-spacing);
8383
+ justify-content: flex-start;
8384
+ align-items: center;
8385
+ grid-template-columns: auto 1fr;
8386
+ grid-template-rows: auto 1fr;
8387
+
8388
+ &[data-label-position='inline'] {
8389
+ gap: var(--form-field-spacing-inline);
8390
+ grid-template-columns: minmax(auto, 1fr) 1fr;
8391
+ grid-template-rows: 1fr auto;
8392
+ }
8393
+
8394
+ &[data-label-position='block'] {
8395
+ gap: var(--form-field-spacing);
8396
+ grid-template-columns: 1fr;
8397
+ grid-template-rows: 1fr;
8398
+ }
8363
8399
  `;
8364
8400
  var StyledErrorList = import_styled_components48.default.ul`
8365
8401
  margin: 0;
@@ -8399,18 +8435,20 @@ var FormField = ({
8399
8435
  name,
8400
8436
  error,
8401
8437
  value,
8438
+ labelPosition,
8439
+ id,
8402
8440
  ...props
8403
8441
  }) => {
8404
8442
  const formState = (0, import_react30.useContext)(FormContext);
8405
8443
  const checkboxGroup = (0, import_react30.useContext)(CheckboxGroupContext);
8406
- const id = props.id ?? `${formState.formId}-${name}`;
8407
- const isInlineLabel = children.type === Checkbox;
8444
+ const isIntegratedLabel = children.type === Checkbox;
8445
+ const computedId = id ?? `${formState.formId}-${name}`;
8408
8446
  const computedError = error ?? formState.errors[name];
8409
8447
  const defaultValue = formState.values[name];
8410
8448
  let childProps = {
8411
8449
  name,
8412
- id,
8413
- label: isInlineLabel ? label : void 0,
8450
+ id: computedId,
8451
+ label: isIntegratedLabel ? label : void 0,
8414
8452
  ...props
8415
8453
  };
8416
8454
  if ((0, import_type_guards28.isUndefined)(value) && (0, import_type_guards28.isNotUndefined)(defaultValue)) {
@@ -8434,21 +8472,31 @@ var FormField = ({
8434
8472
  name: computedName,
8435
8473
  onChange: handleChange,
8436
8474
  "aria-invalid": (0, import_type_guards28.isNotNil)(error),
8437
- "aria-describedby": (0, import_type_guards28.isNotNil)(error) ? `${id}-error` : void 0
8475
+ "aria-describedby": (0, import_type_guards28.isNotNil)(error) ? `${computedId}-error` : void 0
8438
8476
  };
8439
8477
  }
8440
8478
  import_react30.Children.only(children);
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
- ] });
8479
+ return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
8480
+ StyledFormField,
8481
+ {
8482
+ ...props,
8483
+ "data-label-position": labelPosition ?? formState.labelPosition,
8484
+ children: [
8485
+ !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(Label, { htmlFor: computedId, children: label }),
8486
+ (0, import_react30.cloneElement)(children, childProps),
8487
+ (0, import_type_guards28.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_jsx_runtime193.Fragment, { children: [
8488
+ /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", {}),
8489
+ /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
8490
+ ErrorMessages,
8491
+ {
8492
+ errors: computedError,
8493
+ id: `${computedId}-error`
8494
+ }
8495
+ )
8496
+ ] }) : null
8497
+ ]
8498
+ }
8499
+ );
8452
8500
  };
8453
8501
  FormField.displayName = "FormField";
8454
8502
 
@@ -10404,6 +10452,7 @@ var StyledContent3 = (0, import_styled_components71.default)(import_react_select
10404
10452
  border-radius: var(--wui-select-content-border-radius);
10405
10453
  padding: var(--wui-select-option-padding);
10406
10454
  min-width: 200px;
10455
+ z-index: var(--wui-zindex-menu);
10407
10456
  `;
10408
10457
  var Select = (0, import_react55.forwardRef)(
10409
10458
  ({