uikit-react-public 0.47.1 → 0.48.0

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.
@@ -3,6 +3,8 @@ import { render, screen } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import Input from '../Input';
5
5
  import { ThemeContextProvider } from '../../../theme/useTheme';
6
+ import Icon from '../../Icon';
7
+ import IconButton from '../../IconButton';
6
8
 
7
9
  describe('Input', () => {
8
10
  // Snapshot tests
@@ -105,4 +107,36 @@ describe('Input', () => {
105
107
  const input = screen.getByRole('textbox') as HTMLInputElement;
106
108
  expect(input.id).toBe('custom-id');
107
109
  });
110
+
111
+ test('positions a right icon before an icon button', () => {
112
+ render(
113
+ <ThemeContextProvider>
114
+ <Input
115
+ icon={
116
+ <Icon.Search
117
+ testId='right-icon'
118
+ aria-hidden='true'
119
+ />
120
+ }
121
+ iconPosition='right'
122
+ iconButton={
123
+ <IconButton
124
+ testId='icon-button'
125
+ aria-label='Search'
126
+ >
127
+ <Icon.Search />
128
+ </IconButton>
129
+ }
130
+ />
131
+ </ThemeContextProvider>
132
+ );
133
+
134
+ const input = screen.getByTestId('ucl-uikit-input');
135
+ const iconWrapper = screen.getByTestId('right-icon').parentElement;
136
+ const buttonWrapper = screen.getByTestId('icon-button').parentElement;
137
+
138
+ expect(input).toHaveStyle({ paddingRight: '80px' });
139
+ expect(iconWrapper).toHaveStyle({ right: '48px' });
140
+ expect(buttonWrapper).toHaveStyle({ right: '16px' });
141
+ });
108
142
  });
@@ -42,7 +42,7 @@ const Label = forwardRef<Ref, LabelProps>(
42
42
  disabled = disabled ?? contextDisabled;
43
43
  optional = optional ?? contextOptional;
44
44
  const htmlFor = props.htmlFor ?? contextId;
45
- const { mdSemibold } = theme.typography.body;
45
+ const { md, mdSemibold } = theme.typography.body;
46
46
 
47
47
  const baseStyle = css`
48
48
  width: 100%;
@@ -76,6 +76,10 @@ const Label = forwardRef<Ref, LabelProps>(
76
76
  className
77
77
  );
78
78
 
79
+ const optionalStyle = css`
80
+ font-weight: ${md.fontWeight};
81
+ `;
82
+
79
83
  return (
80
84
  <label
81
85
  ref={ref}
@@ -88,7 +92,9 @@ const Label = forwardRef<Ref, LabelProps>(
88
92
  {optional && (
89
93
  <>
90
94
  {' '}
91
- <span className={optionalClassName}>(optional)</span>
95
+ <span className={cx(optionalStyle, optionalClassName)}>
96
+ (optional)
97
+ </span>
92
98
  </>
93
99
  )}
94
100
  </label>
@@ -68,7 +68,9 @@ exports[`Label > snapshot: with optional prop 1`] = `
68
68
  >
69
69
  Name
70
70
 
71
- <span>
71
+ <span
72
+ class="css-dbb56r"
73
+ >
72
74
  (optional)
73
75
  </span>
74
76
  </label>
@@ -4,6 +4,9 @@ export type { IconProps } from './Icon';
4
4
  export { default as Input } from './Input';
5
5
  export type { InputProps } from './Input';
6
6
 
7
+ export { default as ConfidentialInput } from './ConfidentialInput';
8
+ export type { ConfidentialInputProps } from './ConfidentialInput';
9
+
7
10
  export { default as Link } from './Link';
8
11
  export type { LinkProps } from './Link';
9
12
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit-react-public",
3
3
  "private": false,
4
4
  "license": "UNLICENSED",
5
- "version": "0.47.1",
5
+ "version": "0.48.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",