@linzjs/step-ag-grid 34.0.0 → 34.0.2

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.
@@ -2,6 +2,7 @@ import './TextInputFormatted.scss';
2
2
  import { DetailedHTMLProps, InputHTMLAttributes, ReactElement } from 'react';
3
3
  export interface LuiTextInputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
4
4
  value: string;
5
+ width?: string | number;
5
6
  helpText?: string;
6
7
  error?: ReactElement | string | boolean | null;
7
8
  formatted?: string;
@@ -61172,7 +61172,7 @@ const Grid = ({
61172
61172
  // ─── Spread Remaining Params ──────────────────
61173
61173
  ...params
61174
61174
  }) => {
61175
- if (isChromatic()) {
61175
+ if (isChromatic() && sizeColumns !== "fit") {
61176
61176
  sizeColumns = "none";
61177
61177
  }
61178
61178
  const {
@@ -61407,13 +61407,15 @@ const Grid = ({
61407
61407
  ...colDef.cellClassRules,
61408
61408
  "GridCell-readonly": (ccp) => !suppressReadOnlyStyle && !editable(ccp)
61409
61409
  },
61410
- // If chromatic we fix the size to minWidth if set otherwise 120px
61411
- // else whatever user has configured which will probably be undefined
61412
- width: isChromatic() ? colDef.minWidth || 120 : colDef.width
61410
+ // If chromatic we fix the size to minWidth if set otherwise 120px, so non-deterministic
61411
+ // content measurement doesn't affect the snapshot - except under 'fit', which sizes via
61412
+ // flex (proportional to the container) rather than measured content, so it's already
61413
+ // deterministic and must keep the user's configured width.
61414
+ width: isChromatic() && sizeColumns !== "fit" ? colDef.minWidth || 120 : colDef.width
61413
61415
  };
61414
61416
  }
61415
61417
  },
61416
- [params.defaultColDef?.editable, params.loading, params.readOnly, suppressReadOnlyStyle]
61418
+ [params.defaultColDef?.editable, params.loading, params.readOnly, suppressReadOnlyStyle, sizeColumns]
61417
61419
  );
61418
61420
  const columnDefs = React13.useMemo(() => {
61419
61421
  return params.columnDefs.map(mapColDef);
@@ -63208,7 +63210,18 @@ const GridFormDropDown = (props) => {
63208
63210
  var css_248z$1 = ".LuiTextInput.GridLuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#6b6966;line-height:48px;position:absolute;right:14px;top:0}";
63209
63211
  styleInject(css_248z$1);
63210
63212
 
63213
+ const FORMATTED_GAP = 8;
63211
63214
  const TextInputFormatted = (props) => {
63215
+ const formattedRef = React13.useRef(null);
63216
+ const [formattedPadding, setFormattedPadding] = React13.useState(void 0);
63217
+ React13.useLayoutEffect(() => {
63218
+ if (!props.formatted) {
63219
+ setFormattedPadding(void 0);
63220
+ return;
63221
+ }
63222
+ const formattedWidth = formattedRef.current?.offsetWidth ?? 0;
63223
+ setFormattedPadding(formattedWidth + 14 + FORMATTED_GAP);
63224
+ }, [props.formatted]);
63212
63225
  return /* @__PURE__ */ jsxRuntime.jsxs(
63213
63226
  "div",
63214
63227
  {
@@ -63217,6 +63230,7 @@ const TextInputFormatted = (props) => {
63217
63230
  props.error && "hasError",
63218
63231
  props.className
63219
63232
  ),
63233
+ style: { width: props.width, ...props.style },
63220
63234
  children: [
63221
63235
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "LuiTextInput-inputWrapper", children: [
63222
63236
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -63227,14 +63241,17 @@ const TextInputFormatted = (props) => {
63227
63241
  defaultValue: props.value,
63228
63242
  ...lodashEs.omit(props, [
63229
63243
  "error",
63244
+ "width",
63230
63245
  "value",
63231
63246
  "helpText",
63232
63247
  "formatted",
63233
63248
  "className",
63234
63249
  "allowTabToSave",
63235
- "validationSummary"
63250
+ "validationSummary",
63251
+ "style"
63236
63252
  ]),
63237
63253
  className: "LuiTextInput-input",
63254
+ style: formattedPadding != null ? { paddingRight: formattedPadding } : void 0,
63238
63255
  onMouseEnter: (e) => {
63239
63256
  e.currentTarget.focus();
63240
63257
  props.onMouseEnter?.(e);
@@ -63243,7 +63260,7 @@ const TextInputFormatted = (props) => {
63243
63260
  "data-validationsummary": props.validationSummary
63244
63261
  }
63245
63262
  ),
63246
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "LuiTextInput-formatted", children: props.formatted })
63263
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "LuiTextInput-formatted", ref: formattedRef, children: props.formatted })
63247
63264
  ] }),
63248
63265
  /* @__PURE__ */ jsxRuntime.jsx(FormError, { error: props.error, helpText: props.helpText })
63249
63266
  ]
@@ -64267,8 +64284,8 @@ const GridFormTextInput = (props) => {
64267
64284
  setValue(e.target.value);
64268
64285
  },
64269
64286
  error: invalid(),
64287
+ width: props.width ?? 264,
64270
64288
  formatted: props.units,
64271
- style: { width: props.width ?? 240 },
64272
64289
  placeholder: props.placeholder ?? "Type here",
64273
64290
  helpText,
64274
64291
  validationSummary: textInputValidatorPropsToSummary(props)