@rango-dev/ui 0.49.1-next.3 → 0.49.1-next.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiF1B,QAAA,MAAM,SAAS;qBAzDZ,MAAO,SAAS;aAAa,MAAM,SAAS;aAAY,MAAO,SAAS;;;;;;;;;;0CAyDrB,CAAC;AAIvD,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AA+FtC,QAAA,MAAM,SAAS;qBAzEX,MAAG,SAAS;aACZ,MAAO,SAAS;aACX,MAEP,SAAS;;;;;;;;;;0CAqE2C,CAAC;AAIvD,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,6 +1,8 @@
1
1
  export declare const InputContainer: import("@stitches/react/types/styled-component.js").StyledComponent<"div", {
2
2
  fullWidth?: boolean | "true" | "false" | undefined;
3
3
  size?: "small" | "large" | undefined;
4
+ suffix?: boolean | "true" | "false" | undefined;
5
+ prefix?: boolean | "true" | "false" | undefined;
4
6
  variant?: "contained" | "outlined" | "ghost" | undefined;
5
7
  disabled?: boolean | "true" | "false" | undefined;
6
8
  status?: "default" | "success" | "warning" | "error" | undefined;
@@ -165,7 +167,8 @@ export declare const InputContainer: import("@stitches/react/types/styled-compon
165
167
  transitions: {};
166
168
  }, import("@stitches/react/types/config.js").DefaultThemeMap, {}>>;
167
169
  export declare const Input: import("@stitches/react/types/styled-component.js").StyledComponent<"input", {
168
- suffix?: boolean | "true" | undefined;
170
+ prefix?: boolean | "true" | "false" | undefined;
171
+ size?: "small" | "large" | undefined;
169
172
  }, {
170
173
  xs: string;
171
174
  sm: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextField/TextField.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAgGzB,CAAC;AAEH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAsChB,CAAC;AAEH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAEhB,CAAC"}
1
+ {"version":3,"file":"TextField.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/TextField/TextField.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAsIzB,CAAC;AAEH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAiEhB,CAAC;AAEH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAEhB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/ui",
3
- "version": "0.49.1-next.3",
3
+ "version": "0.49.1-next.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -62,4 +62,4 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  }
65
- }
65
+ }
@@ -17,14 +17,24 @@ export const InputContainer = styled('div', {
17
17
  },
18
18
  },
19
19
  size: {
20
- small: {
21
- padding: '$5 $15',
22
- },
20
+ small: {},
23
21
  large: {
24
- padding: '$10',
25
22
  borderRadius: '$xl',
26
23
  },
27
24
  },
25
+ suffix: {
26
+ true: {},
27
+ false: {
28
+ padding: 0,
29
+ },
30
+ },
31
+ prefix: {
32
+ true: {},
33
+ false: {
34
+ padding: 0,
35
+ },
36
+ },
37
+
28
38
  variant: {
29
39
  contained: {
30
40
  $$color: '$colors$neutral100',
@@ -77,6 +87,34 @@ export const InputContainer = styled('div', {
77
87
  },
78
88
 
79
89
  compoundVariants: [
90
+ {
91
+ size: 'small',
92
+ suffix: true,
93
+ css: {
94
+ paddingRight: '$15',
95
+ },
96
+ },
97
+ {
98
+ size: 'small',
99
+ prefix: true,
100
+ css: {
101
+ paddingLeft: '$15',
102
+ },
103
+ },
104
+ {
105
+ size: 'large',
106
+ suffix: true,
107
+ css: {
108
+ paddingRight: '$10',
109
+ },
110
+ },
111
+ {
112
+ size: 'large',
113
+ prefix: true,
114
+ css: {
115
+ paddingLeft: '$10',
116
+ },
117
+ },
80
118
  {
81
119
  variant: 'contained',
82
120
  disabled: true,
@@ -109,10 +147,37 @@ export const Input = styled('input', {
109
147
  fontFamily: 'inherit',
110
148
  maxWidth: '100%',
111
149
  variants: {
112
- suffix: {
113
- true: { marginRight: '$10' },
150
+ prefix: {
151
+ true: {
152
+ paddingLeft: '$0',
153
+ },
154
+ false: {},
155
+ },
156
+ size: {
157
+ small: {
158
+ padding: '$6 $15 $6 $0',
159
+ },
160
+ large: {
161
+ padding: '$10 $10 $10 $0',
162
+ },
114
163
  },
115
164
  },
165
+ compoundVariants: [
166
+ {
167
+ size: 'small',
168
+ prefix: false,
169
+ css: {
170
+ paddingLeft: '$15',
171
+ },
172
+ },
173
+ {
174
+ size: 'large',
175
+ prefix: false,
176
+ css: {
177
+ paddingLeft: '$10',
178
+ },
179
+ },
180
+ ],
116
181
  backgroundColor: 'transparent',
117
182
  '-webkit-appearance': 'none',
118
183
  margin: 0,
@@ -1,7 +1,7 @@
1
1
  import type { Ref, TextFieldPropTypes } from './TextField.types.js';
2
2
  import type { PropsWithChildren } from 'react';
3
3
 
4
- import React from 'react';
4
+ import React, { useRef } from 'react';
5
5
 
6
6
  import { Divider } from '../Divider/index.js';
7
7
  import { Typography } from '../Typography/index.js';
@@ -12,6 +12,8 @@ function TextFieldComponent(
12
12
  props: PropsWithChildren<TextFieldPropTypes>,
13
13
  ref?: Ref
14
14
  ) {
15
+ const inputRef = useRef<HTMLInputElement>(null);
16
+
15
17
  const {
16
18
  label,
17
19
  prefix,
@@ -44,6 +46,14 @@ function TextFieldComponent(
44
46
  }
45
47
  };
46
48
 
49
+ const handleClick = () => {
50
+ if (ref && 'current' in ref && ref.current) {
51
+ ref.current.focus();
52
+ } else if (inputRef.current) {
53
+ inputRef.current.focus();
54
+ }
55
+ };
56
+
47
57
  return (
48
58
  <>
49
59
  {label && (
@@ -65,18 +75,22 @@ function TextFieldComponent(
65
75
  size={size}
66
76
  css={style}
67
77
  status={status}
78
+ suffix={!!suffix}
79
+ prefix={!!prefix}
80
+ onClick={handleClick}
68
81
  className="_text-field">
69
- {prefix || null}
82
+ {prefix}
70
83
  <Input
71
84
  autoComplete="off"
72
85
  {...inputAttributes}
73
86
  onKeyDown={handleKeyDown}
74
87
  onPaste={handlePaste}
75
88
  spellCheck={false}
76
- suffix={!!suffix}
77
- ref={ref}
89
+ prefix={!!prefix}
90
+ size={size}
91
+ ref={ref || inputRef}
78
92
  />
79
- {suffix || null}
93
+ {suffix}
80
94
  </InputContainer>
81
95
  </>
82
96
  );