@linzjs/step-ag-grid 34.0.1 → 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.
- package/dist/src/lui/TextInputFormatted.d.ts +1 -0
- package/dist/step-ag-grid.cjs +18 -3
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +18 -3
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridForm/GridFormTextInput.tsx +1 -1
- package/src/lui/TextInputFormatted.tsx +25 -2
- package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +1 -0
|
@@ -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;
|
package/dist/step-ag-grid.cjs
CHANGED
|
@@ -63210,7 +63210,18 @@ const GridFormDropDown = (props) => {
|
|
|
63210
63210
|
var css_248z$1 = ".LuiTextInput.GridLuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#6b6966;line-height:48px;position:absolute;right:14px;top:0}";
|
|
63211
63211
|
styleInject(css_248z$1);
|
|
63212
63212
|
|
|
63213
|
+
const FORMATTED_GAP = 8;
|
|
63213
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]);
|
|
63214
63225
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
63215
63226
|
"div",
|
|
63216
63227
|
{
|
|
@@ -63219,6 +63230,7 @@ const TextInputFormatted = (props) => {
|
|
|
63219
63230
|
props.error && "hasError",
|
|
63220
63231
|
props.className
|
|
63221
63232
|
),
|
|
63233
|
+
style: { width: props.width, ...props.style },
|
|
63222
63234
|
children: [
|
|
63223
63235
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "LuiTextInput-inputWrapper", children: [
|
|
63224
63236
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -63229,14 +63241,17 @@ const TextInputFormatted = (props) => {
|
|
|
63229
63241
|
defaultValue: props.value,
|
|
63230
63242
|
...lodashEs.omit(props, [
|
|
63231
63243
|
"error",
|
|
63244
|
+
"width",
|
|
63232
63245
|
"value",
|
|
63233
63246
|
"helpText",
|
|
63234
63247
|
"formatted",
|
|
63235
63248
|
"className",
|
|
63236
63249
|
"allowTabToSave",
|
|
63237
|
-
"validationSummary"
|
|
63250
|
+
"validationSummary",
|
|
63251
|
+
"style"
|
|
63238
63252
|
]),
|
|
63239
63253
|
className: "LuiTextInput-input",
|
|
63254
|
+
style: formattedPadding != null ? { paddingRight: formattedPadding } : void 0,
|
|
63240
63255
|
onMouseEnter: (e) => {
|
|
63241
63256
|
e.currentTarget.focus();
|
|
63242
63257
|
props.onMouseEnter?.(e);
|
|
@@ -63245,7 +63260,7 @@ const TextInputFormatted = (props) => {
|
|
|
63245
63260
|
"data-validationsummary": props.validationSummary
|
|
63246
63261
|
}
|
|
63247
63262
|
),
|
|
63248
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "LuiTextInput-formatted", children: props.formatted })
|
|
63263
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "LuiTextInput-formatted", ref: formattedRef, children: props.formatted })
|
|
63249
63264
|
] }),
|
|
63250
63265
|
/* @__PURE__ */ jsxRuntime.jsx(FormError, { error: props.error, helpText: props.helpText })
|
|
63251
63266
|
]
|
|
@@ -64269,8 +64284,8 @@ const GridFormTextInput = (props) => {
|
|
|
64269
64284
|
setValue(e.target.value);
|
|
64270
64285
|
},
|
|
64271
64286
|
error: invalid(),
|
|
64287
|
+
width: props.width ?? 264,
|
|
64272
64288
|
formatted: props.units,
|
|
64273
|
-
style: { width: props.width ?? 240 },
|
|
64274
64289
|
placeholder: props.placeholder ?? "Type here",
|
|
64275
64290
|
helpText,
|
|
64276
64291
|
validationSummary: textInputValidatorPropsToSummary(props)
|