@onewelcome/react-lib-components 0.1.2-alpha → 0.1.3-alpha

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onewelcome/react-lib-components",
3
- "version": "0.1.2-alpha",
3
+ "version": "0.1.3-alpha",
4
4
  "license": "Apache-2.0",
5
5
  "author": "OneWelcome B.V.",
6
6
  "main": "dist/index.js",
@@ -54,7 +54,7 @@ export const FormGroup = React.forwardRef<HTMLDivElement, Props>(
54
54
  >
55
55
  {helperText && !error && (
56
56
  <FormHelperText {...helperProps} className={''} id={helperId}>
57
- {helperText}
57
+ {(helperProps && helperProps.children) || helperText}
58
58
  </FormHelperText>
59
59
  )}
60
60
  {error && errorMessage && (
@@ -45,18 +45,19 @@ export const FormSelectorWrapper = React.forwardRef<HTMLDivElement, Props>(
45
45
  }`}
46
46
  >
47
47
  <div {...containerProps}>{children}</div>
48
- {helperText && (!error || parentErrorId || !errorMessage) && (
49
- <FormHelperText
50
- {...helperProps}
51
- ref={helperRef}
52
- id={`${identifier}`}
53
- className={`${classes['helper-text']} ${helperProps?.className ?? ''} ${
54
- error ? classes['error'] : ''
55
- }`}
56
- >
57
- {helperText}
58
- </FormHelperText>
59
- )}
48
+ {(helperText || (helperProps && helperProps.children)) &&
49
+ (!error || parentErrorId || !errorMessage) && (
50
+ <FormHelperText
51
+ {...helperProps}
52
+ ref={helperRef}
53
+ id={`${identifier}`}
54
+ className={`${classes['helper-text']} ${helperProps?.className ?? ''} ${
55
+ error ? classes['error'] : ''
56
+ }`}
57
+ >
58
+ {(helperProps && helperProps.children) || helperText}
59
+ </FormHelperText>
60
+ )}
60
61
  {errorMessage && !parentErrorId && error && (
61
62
  <span className={classes['error-message']}>
62
63
  <Icon className={classes['error-icon']} icon={Icons.Error} />
@@ -38,6 +38,7 @@
38
38
  font-family: var(--font-family);
39
39
  width: 100%;
40
40
  box-sizing: border-box;
41
+ padding: 0;
41
42
 
42
43
  &:focus:not(:disabled) {
43
44
  outline: none;
@@ -19,10 +19,15 @@ input {
19
19
  }
20
20
 
21
21
  .input-wrapper [data-icon]:before {
22
- transform: translateY(5px);
22
+ transition: 0.2s ease-in-out;
23
+ transform: translateY(0px);
23
24
  font-size: 1.125rem;
24
25
  }
25
26
 
27
+ .input-wrapper .floating-label-active [data-icon]:before {
28
+ transform: translateY(5px);
29
+ }
30
+
26
31
  .input-wrapper [data-prefix],
27
32
  .input-wrapper [data-suffix] {
28
33
  transform: translateY(-0.125rem);
@@ -54,6 +54,7 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
54
54
  helperText,
55
55
  helperProps,
56
56
  value,
57
+ className,
57
58
  error,
58
59
  onChange,
59
60
  onBlur,
@@ -90,7 +91,7 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
90
91
  {...rest}
91
92
  ref={ref || wrapper}
92
93
  name={name}
93
- className={classes['input-wrapper']}
94
+ className={`${classes['input-wrapper']} ${className ?? ''}`}
94
95
  labelProps={{
95
96
  id: labelId,
96
97
  className: labelClasses.join(' '),
@@ -111,7 +112,11 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
111
112
  {...inputProps}
112
113
  prefix={hasValueOrActiveFloatingLabel ? prefix : ''}
113
114
  suffix={hasValueOrActiveFloatingLabel ? suffix : ''}
114
- wrapperProps={{ className: floatingLabelActive ? classes['floating-label-active'] : '' }}
115
+ wrapperProps={{
116
+ className: `${floatingLabelActive ? classes['floating-label-active'] : ''} ${
117
+ inputProps?.wrapperProps?.className ?? ''
118
+ }`,
119
+ }}
115
120
  ref={(inputProps && inputProps.ref) || input}
116
121
  aria-labelledby={labelId}
117
122
  aria-describedby={error ? errorId : helperId}
@@ -132,7 +137,9 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
132
137
  ? setFloatingLabelActive(true)
133
138
  : setFloatingLabelActive(false);
134
139
  }}
135
- className={floatingLabelActive ? classes['floating-label'] : ''}
140
+ className={`${floatingLabelActive ? classes['floating-label'] : ''} ${
141
+ inputProps?.className ?? ''
142
+ }`}
136
143
  name={name}
137
144
  error={error}
138
145
  id={name}
@@ -1,7 +1,7 @@
1
1
  .textarea-label {
2
2
  left: calc(
3
- 1.25rem + 2px
4
- ); // 2px is for offset of the textarea border. It's relative to the parent div which doesn't have a border.
3
+ 1.25rem + 1px
4
+ ); // 1px is for offset of the textarea border. It's relative to the parent div which doesn't have a border.
5
5
 
6
6
  &.focus {
7
7
  color: var(--color-primary);
@@ -7,7 +7,7 @@
7
7
  position: absolute;
8
8
  z-index: 1;
9
9
  top: 1.3125rem;
10
- left: 1.25rem;
10
+ left: 1.35rem;
11
11
  transform-origin: left top;
12
12
  transition: all 0.2s ease-in-out;
13
13
  pointer-events: none;