@peassoft/mnr-web-ui-kit 0.1.0 → 0.1.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.
@@ -7,6 +7,8 @@ type Props = {
7
7
  label: string;
8
8
  /** autocomplete attribute */
9
9
  autocompleteAttribute?: string;
10
+ /** disabled attribule */
11
+ disabled?: boolean;
10
12
  /** Width in any CSS length value */
11
13
  width?: string;
12
14
  /** Error message */
@@ -15,7 +17,13 @@ type Props = {
15
17
  value: string;
16
18
  /** Ref */
17
19
  ref?: React.RefObject<HTMLInputElement | null>;
18
- /** onChange callback */
20
+ /**
21
+ * onChange callback
22
+ *
23
+ * For disabled state (when passing `disabled` attribute), pass a noop function
24
+ * (like, `() => {}`) to prevent React's warnings about controlled components
25
+ * (with `value` prop) having no `onChange` handler.
26
+ */
19
27
  onChange: (newValue: string) => unknown;
20
28
  /** Optional handler of Tab key press */
21
29
  onTab?: () => unknown;
@@ -7,6 +7,7 @@ export function InputField(props) {
7
7
  type = 'text',
8
8
  label,
9
9
  autocompleteAttribute,
10
+ disabled = false,
10
11
  width = '100%',
11
12
  errorMessage,
12
13
  value,
@@ -59,6 +60,7 @@ export function InputField(props) {
59
60
  className: 'uikit_InputField_input',
60
61
  type: type,
61
62
  autoComplete: autocompleteAttribute,
63
+ disabled: disabled,
62
64
  value: value,
63
65
  onChange: handleChange,
64
66
  onKeyDown: handleKeyDown,
@@ -28,6 +28,11 @@
28
28
  font-family: inherit;
29
29
  }
30
30
 
31
+ .uikit_InputField_input:disabled {
32
+ color: #848484;
33
+ background-color: #efefef;
34
+ }
35
+
31
36
  .uikit_InputField_capslockMsg {
32
37
  display: flex;
33
38
  gap: .5em;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peassoft/mnr-web-ui-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Peassoft web UI kit for MNR web applications",
5
5
  "type": "module",
6
6
  "exports": {