@basic-ui/material 0.1.15 → 0.1.16

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.
Files changed (55) hide show
  1. package/build/cjs/index.js +58 -43
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/Combobox/Combobox.d.ts +7 -7
  4. package/build/esm/Combobox/Combobox.js +1 -0
  5. package/build/esm/Combobox/Combobox.js.map +1 -1
  6. package/build/esm/FloatingLabel/FloatingLabel.d.ts +0 -1
  7. package/build/esm/FloatingLabel/FloatingLabel.js +1 -3
  8. package/build/esm/FloatingLabel/FloatingLabel.js.map +1 -1
  9. package/build/esm/Menu/Menu.d.ts +4 -4
  10. package/build/esm/Menu/Menu.js +1 -0
  11. package/build/esm/Menu/Menu.js.map +1 -1
  12. package/build/esm/NotchedOutline/styledComponents.js +2 -2
  13. package/build/esm/NotchedOutline/styledComponents.js.map +1 -1
  14. package/build/esm/Select/Select.d.ts +3 -3
  15. package/build/esm/Select/Select.js +3 -12
  16. package/build/esm/Select/Select.js.map +1 -1
  17. package/build/esm/Select/SelectIcon.d.ts +1 -1
  18. package/build/esm/Select/SelectIcon.js +3 -1
  19. package/build/esm/Select/SelectIcon.js.map +1 -1
  20. package/build/esm/Select/styledComponents.js +9 -5
  21. package/build/esm/Select/styledComponents.js.map +1 -1
  22. package/build/esm/SelectItem/SelectItem.d.ts +1 -1
  23. package/build/esm/TextField/FilledContainer.d.ts +1 -1
  24. package/build/esm/TextField/FilledContainer.js +11 -5
  25. package/build/esm/TextField/FilledContainer.js.map +1 -1
  26. package/build/esm/TextField/IconContainer.d.ts +2 -2
  27. package/build/esm/TextField/IconContainer.js +4 -2
  28. package/build/esm/TextField/IconContainer.js.map +1 -1
  29. package/build/esm/TextField/Input.d.ts +1 -1
  30. package/build/esm/TextField/Input.js +17 -9
  31. package/build/esm/TextField/Input.js.map +1 -1
  32. package/build/esm/TextField/OutlinedContainer.d.ts +1 -1
  33. package/build/esm/TextField/OutlinedContainer.js +7 -4
  34. package/build/esm/TextField/OutlinedContainer.js.map +1 -1
  35. package/build/esm/TextField/TextField.d.ts +1 -1
  36. package/build/esm/TextField/consts.d.ts +5 -0
  37. package/build/esm/TextField/consts.js +6 -0
  38. package/build/esm/TextField/consts.js.map +1 -0
  39. package/build/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +2 -2
  41. package/src/Combobox/Combobox.tsx +1 -0
  42. package/src/FloatingLabel/FloatingLabel.tsx +0 -3
  43. package/src/Menu/Menu.tsx +1 -0
  44. package/src/NotchedOutline/styledComponents.ts +1 -1
  45. package/src/Select/PaymentMethodSelect.story.tsx +321 -0
  46. package/src/Select/Select.story.tsx +26 -1
  47. package/src/Select/Select.tsx +12 -34
  48. package/src/Select/SelectIcon.tsx +2 -1
  49. package/src/Select/styledComponents.tsx +8 -4
  50. package/src/TextField/FilledContainer.tsx +22 -5
  51. package/src/TextField/IconContainer.tsx +5 -4
  52. package/src/TextField/Input.tsx +29 -9
  53. package/src/TextField/OutlinedContainer.tsx +18 -4
  54. package/src/TextField/TextField.story.tsx +14 -1
  55. package/src/TextField/consts.ts +7 -0
@@ -10,6 +10,11 @@ import { NotchedOutline } from '../NotchedOutline';
10
10
  import { Box, BoxProps } from '../Box';
11
11
  import { FloatingLabel } from '../FloatingLabel';
12
12
  import { Theme } from '../theme';
13
+ import {
14
+ ICON_WIDTH,
15
+ PADDING_LEFT_WITHOUT_ICON,
16
+ PADDING_LEFT_WITH_ICON,
17
+ } from './consts';
13
18
 
14
19
  const useEnhancedEffect =
15
20
  typeof window !== 'undefined' ? useLayoutEffect : useEffect;
@@ -61,9 +66,10 @@ export const OutlinedContainer = forwardRef<
61
66
  }, [label]);
62
67
 
63
68
  const color = error ? 'error' : colorProp;
69
+ const inputHeight = 56;
64
70
 
65
71
  return (
66
- <Box position="relative" {...otherProps}>
72
+ <Box position="relative" lineHeight={0} {...otherProps}>
67
73
  <NotchedOutline
68
74
  ref={forwardedRef}
69
75
  borderRadius={4}
@@ -76,9 +82,17 @@ export const OutlinedContainer = forwardRef<
76
82
  label={
77
83
  label && (
78
84
  <FloatingLabel
79
- height={56}
80
- offsetX={leadingIcon ? 48 : 16}
81
- translateX={leadingIcon ? -32 : 0}
85
+ height={inputHeight}
86
+ offsetX={
87
+ leadingIcon
88
+ ? PADDING_LEFT_WITH_ICON +
89
+ ICON_WIDTH +
90
+ PADDING_LEFT_WITHOUT_ICON
91
+ : PADDING_LEFT_WITHOUT_ICON
92
+ }
93
+ translateX={
94
+ leadingIcon ? -(PADDING_LEFT_WITH_ICON + ICON_WIDTH) : 0
95
+ }
82
96
  active={forceActive || labelIsFloating}
83
97
  ref={labelRef}
84
98
  htmlFor={inputId}
@@ -10,6 +10,19 @@ export default {
10
10
  title: 'components/TextField',
11
11
  };
12
12
 
13
+ const SearchIcon = (props) => (
14
+ <svg
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ height={24}
17
+ width={24}
18
+ viewBox="0 0 48 48"
19
+ fill="currentColor"
20
+ {...props}
21
+ >
22
+ <path d="M39.8 41.95 26.65 28.8q-1.5 1.3-3.5 2.025-2 .725-4.25.725-5.4 0-9.15-3.75T6 18.75q0-5.3 3.75-9.05 3.75-3.75 9.1-3.75 5.3 0 9.025 3.75 3.725 3.75 3.725 9.05 0 2.15-.7 4.15-.7 2-2.1 3.75L42 39.75Zm-20.95-13.4q4.05 0 6.9-2.875Q28.6 22.8 28.6 18.75t-2.85-6.925Q22.9 8.95 18.85 8.95q-4.1 0-6.975 2.875T9 18.75q0 4.05 2.875 6.925t6.975 2.875Z" />
23
+ </svg>
24
+ );
25
+
13
26
  const Example = ({ variant }) => {
14
27
  const [error, setError] = useState<boolean | string>(false);
15
28
  const [color, setColor] = useState<'primary' | 'secondary'>('primary');
@@ -159,7 +172,7 @@ const Example = ({ variant }) => {
159
172
  label="With icon"
160
173
  error={error}
161
174
  color={color}
162
- leadingIcon={'O'}
175
+ leadingIcon={<SearchIcon />}
163
176
  />
164
177
  </Box>
165
178
  <Box m={2} width={230} display="inline-block">
@@ -0,0 +1,7 @@
1
+ export const PADDING_LEFT_WITH_ICON = 14;
2
+ export const PADDING_LEFT_WITHOUT_ICON = 16;
3
+
4
+ export const ICON_WIDTH = 24;
5
+
6
+ export const PADDING_RIGHT_WITH_ICON = 12;
7
+ export const PADDING_RIGHT_WITHOUT_ICON = 16;