@wistia/ui 0.18.0 → 0.18.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 CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.18.0
3
+ * @license @wistia/ui v0.18.1
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -307,11 +307,6 @@ var globalStyleAdjustmentsCss = import_styled_components.css`
307
307
  font-size: inherit;
308
308
  }
309
309
 
310
- /* Make sure textareas without a rows attribute are not tiny */
311
- textarea:not([rows]) {
312
- min-height: 10em;
313
- }
314
-
315
310
  /* Anything that has been anchored to should have extra scroll margin */
316
311
  &:target {
317
312
  scroll-margin-block: 5ex;
@@ -11774,11 +11769,13 @@ var inputStyles = import_styled_components62.css`
11774
11769
  }
11775
11770
  }
11776
11771
  `;
11772
+ var calculateTextareaHeight = (rows = 1) => `calc((var(--wui-input-line-height) * ${rows}) + (var(--wui-input-vertical-padding) * 2));`;
11777
11773
  var StyledInputContainer = import_styled_components62.styled.div`
11778
11774
  display: inline-flex;
11779
11775
  position: relative;
11780
11776
  ${inputStyles};
11781
11777
  width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
11778
+ height: ${({ $fullHeight, $isMultiline }) => $fullHeight && $isMultiline ? "100%" : "auto"};
11782
11779
 
11783
11780
  input,
11784
11781
  textarea {
@@ -11787,9 +11784,51 @@ var StyledInputContainer = import_styled_components62.styled.div`
11787
11784
  }
11788
11785
 
11789
11786
  textarea {
11787
+ --wui-input-line-height: var(--wui-typography-body-3-line-height);
11788
+
11790
11789
  border-radius: var(--wui-input-multiline-border-radius);
11790
+ height: ${({ $fullHeight }) => $fullHeight ? "100%" : "auto"};
11791
+
11792
+ /* override height calculations when fullHeight is enabled */
11793
+ ${({ $fullHeight }) => $fullHeight && `
11794
+ &[rows='1'],
11795
+ &[rows='2'],
11796
+ &[rows='3'],
11797
+ &[rows='4'],
11798
+ &[rows='5'],
11799
+ &:not([rows]) {
11800
+ height: 100%;
11801
+ resize: none;
11802
+ }
11803
+ `}
11791
11804
 
11792
- --wui-input-line-height: var(--wui-typography-body-3-line-height);
11805
+ /* height based on rows attribute (1-5) - only when fullHeight is not enabled */
11806
+ ${({ $fullHeight }) => !$fullHeight && `
11807
+ &[rows='1'] {
11808
+ height: ${calculateTextareaHeight(1)};
11809
+ }
11810
+
11811
+ &[rows='2'] {
11812
+ height: ${calculateTextareaHeight(2)};
11813
+ }
11814
+
11815
+ &[rows='3'] {
11816
+ height: ${calculateTextareaHeight(3)};
11817
+ }
11818
+
11819
+ &[rows='4'] {
11820
+ height: ${calculateTextareaHeight(4)};
11821
+ }
11822
+
11823
+ &[rows='5'] {
11824
+ height: ${calculateTextareaHeight(5)};
11825
+ }
11826
+
11827
+ /* make sure textareas without a rows attribute are not tiny */
11828
+ &:not([rows]) {
11829
+ height: ${calculateTextareaHeight(5)};
11830
+ }
11831
+ `}
11793
11832
  }
11794
11833
 
11795
11834
  [type='search'] {
@@ -11844,6 +11883,7 @@ var StyledInputContainer = import_styled_components62.styled.div`
11844
11883
  var Input = (0, import_react47.forwardRef)(
11845
11884
  ({
11846
11885
  fullWidth = true,
11886
+ fullHeight = false,
11847
11887
  monospace = false,
11848
11888
  type = "text",
11849
11889
  autoSelect = false,
@@ -11883,7 +11923,9 @@ var Input = (0, import_react47.forwardRef)(
11883
11923
  return /* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(
11884
11924
  StyledInputContainer,
11885
11925
  {
11926
+ $fullHeight: fullHeight,
11886
11927
  $fullWidth: fullWidth,
11928
+ $isMultiline: type === "multiline",
11887
11929
  $monospace: monospace,
11888
11930
  "data-wui-input-container": true,
11889
11931
  children: [
@@ -14191,6 +14233,10 @@ var StyledInput = (0, import_styled_components81.styled)(Input)`
14191
14233
  min-height: unset;
14192
14234
  }
14193
14235
 
14236
+ &:focus {
14237
+ height: ${({ $height }) => `${$height}px !important`};
14238
+ }
14239
+
14194
14240
  && {
14195
14241
  ${({ $variant }) => variantStyleMap[$variant]}
14196
14242
  /* The input font styles (edit mode) needs the same font styles as Heading */
@@ -14990,6 +15036,7 @@ var FormField = ({
14990
15036
  id: computedId,
14991
15037
  label: isIntegratedLabel ? label : void 0,
14992
15038
  "aria-describedby": ariaDescribedby,
15039
+ "aria-invalid": (0, import_type_guards49.isNotNil)(computedError),
14993
15040
  ...props
14994
15041
  };
14995
15042
  if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
@@ -15011,8 +15058,7 @@ var FormField = ({
15011
15058
  childProps = {
15012
15059
  ...childProps,
15013
15060
  name: computedName,
15014
- onChange: handleChange,
15015
- "aria-invalid": (0, import_type_guards49.isNotNil)(error)
15061
+ onChange: handleChange
15016
15062
  };
15017
15063
  }
15018
15064
  import_react73.Children.only(children);