@lets-events/react 11.0.1 → 11.0.3

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/dist/index.mjs CHANGED
@@ -2660,7 +2660,7 @@ var InputAddon = styled(TextStyle, {
2660
2660
  });
2661
2661
  var maskFormat = format;
2662
2662
  var maskUnformat = unformat;
2663
- function TextField(_a) {
2663
+ var TextField = (_a) => {
2664
2664
  var _b = _a, {
2665
2665
  children,
2666
2666
  isValid: isValid2,
@@ -2670,7 +2670,8 @@ function TextField(_a) {
2670
2670
  fontWeight,
2671
2671
  addon,
2672
2672
  textAlign = "left",
2673
- mask
2673
+ mask,
2674
+ ref
2674
2675
  } = _b, props = __objRest(_b, [
2675
2676
  "children",
2676
2677
  "isValid",
@@ -2680,7 +2681,8 @@ function TextField(_a) {
2680
2681
  "fontWeight",
2681
2682
  "addon",
2682
2683
  "textAlign",
2683
- "mask"
2684
+ "mask",
2685
+ "ref"
2684
2686
  ]);
2685
2687
  const maskRef = mask ? useMask(mask) : void 0;
2686
2688
  return /* @__PURE__ */ jsxs(Flex2, { gap: "0", css: { width: "100%" }, children: [
@@ -2694,7 +2696,14 @@ function TextField(_a) {
2694
2696
  typography,
2695
2697
  fontWeight,
2696
2698
  textAlign,
2697
- ref: maskRef
2699
+ ref: (r) => {
2700
+ if (!r) return;
2701
+ if (maskRef) maskRef.current = r;
2702
+ if (ref) {
2703
+ if (typeof ref === "function") ref(r);
2704
+ else ref.current = r;
2705
+ }
2706
+ }
2698
2707
  }, props), {
2699
2708
  style: addon ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" } : void 0,
2700
2709
  children: [
@@ -2715,7 +2724,7 @@ function TextField(_a) {
2715
2724
  })
2716
2725
  )
2717
2726
  ] });
2718
- }
2727
+ };
2719
2728
  function TextFieldSlot(_a) {
2720
2729
  var _b = _a, {
2721
2730
  children,
@@ -8614,20 +8623,15 @@ function StepWrapper(_a) {
8614
8623
  }
8615
8624
 
8616
8625
  // src/components/Card.tsx
8617
- import React5 from "react";
8618
- import { Box as Box3, Card as CardRadix } from "@radix-ui/themes";
8626
+ import { Card as CardRadix } from "@radix-ui/themes";
8619
8627
  import { jsx as jsx19 } from "react/jsx-runtime";
8620
8628
  var CardStyled = styled(CardRadix, {
8621
- display: "flex",
8622
- flexDirection: "column",
8623
- width: "370px",
8624
8629
  borderRadius: "$2xl",
8625
8630
  border: "1px solid $dark100",
8626
- overflow: "hidden",
8627
8631
  padding: "16px",
8628
8632
  defaultVariants: {
8629
8633
  color: "primary",
8630
- boxShadow: true
8634
+ boxShadow: false
8631
8635
  },
8632
8636
  variants: {
8633
8637
  color: {
@@ -8654,18 +8658,9 @@ var CardStyled = styled(CardRadix, {
8654
8658
  }
8655
8659
  }
8656
8660
  });
8657
- var CardContainer = styled(Box3, {
8658
- display: "flex",
8659
- flexDirection: "row"
8660
- });
8661
8661
  function Card(_a) {
8662
8662
  var _b = _a, { asChild, children } = _b, props = __objRest(_b, ["asChild", "children"]);
8663
- return /* @__PURE__ */ jsx19(CardStyled, __spreadProps(__spreadValues({}, props), { children: React5.Children.map(children, (child) => {
8664
- if (React5.isValidElement(child)) {
8665
- return React5.cloneElement(child, { size: props.size });
8666
- }
8667
- return child;
8668
- }) }));
8663
+ return /* @__PURE__ */ jsx19(CardStyled, __spreadProps(__spreadValues({}, props), { children }));
8669
8664
  }
8670
8665
 
8671
8666
  // src/components/TextareaField.tsx
@@ -9224,7 +9219,6 @@ export {
9224
9219
  ButtonItemStyled,
9225
9220
  Calendar,
9226
9221
  Card,
9227
- CardContainer,
9228
9222
  CardStyled,
9229
9223
  CheckboxGroup,
9230
9224
  CheckboxGroupStyled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "11.0.1",
3
+ "version": "11.0.3",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -1,69 +1,48 @@
1
- import React from 'react'
2
- import { ComponentProps, ElementType } from 'react'
3
- import { styled } from '../styles'
4
- import { Box, Card as CardRadix } from '@radix-ui/themes'
1
+ import React from "react";
2
+ import { ComponentProps, ElementType } from "react";
3
+ import { styled } from "../styles";
4
+ import { Box, Card as CardRadix } from "@radix-ui/themes";
5
5
 
6
6
  export const CardStyled = styled(CardRadix, {
7
- display: 'flex',
8
- flexDirection: 'column',
9
- width: '370px',
10
- borderRadius: '$2xl',
11
- border: '1px solid $dark100',
12
- overflow: 'hidden',
13
- padding: '16px',
14
- defaultVariants: {
15
- color: 'primary',
16
- boxShadow: true,
7
+ borderRadius: "$2xl",
8
+ border: "1px solid $dark100",
9
+ padding: "16px",
10
+ defaultVariants: {
11
+ color: "primary",
12
+ boxShadow: false,
13
+ },
14
+ variants: {
15
+ color: {
16
+ primary: {
17
+ backgroundColor: "$dark50",
18
+ border: "1px solid $dark200",
19
+ },
20
+ disable: {
21
+ backgroundColor: "$grey50",
22
+ border: "1px solid $dark200",
23
+ },
24
+ error: {
25
+ backgroundColor: "$error50",
26
+ border: "1px solid $error600",
27
+ },
17
28
  },
18
- variants: {
19
- color: {
20
- primary: {
21
- backgroundColor: '$dark50',
22
- border: '1px solid $dark200',
23
- },
24
- disable: {
25
- backgroundColor: '$grey50',
26
- border: '1px solid $dark200',
27
- },
28
- error: {
29
- backgroundColor: '$error50',
30
- border: '1px solid $error600',
31
- }
32
- },
33
- boxShadow:{
34
- true: {
35
- boxShadow: '0 2px 4px rgba(35, 53, 67, 0.16), 0 4px 4px rgba(35, 53, 67, 0.08)',
36
- },
37
- false: {
38
- boxShadow: 'none',
39
- }
40
- }
41
- }
29
+ boxShadow: {
30
+ true: {
31
+ boxShadow:
32
+ "0 2px 4px rgba(35, 53, 67, 0.16), 0 4px 4px rgba(35, 53, 67, 0.08)",
33
+ },
34
+ false: {
35
+ boxShadow: "none",
36
+ },
37
+ },
38
+ },
42
39
  });
43
40
 
44
-
45
-
46
- export const CardContainer = styled(Box, {
47
- display: 'flex',
48
- flexDirection: 'row'
49
- })
50
-
51
41
  export type CardProps = ComponentProps<typeof CardStyled> & {
52
- children: React.ReactNode
53
- as?: ElementType
54
- }
55
-
56
-
42
+ children: React.ReactNode;
43
+ as?: ElementType;
44
+ };
57
45
 
58
46
  export function Card({ asChild, children, ...props }: CardProps) {
59
- return (
60
- <CardStyled {...props}>
61
- {React.Children.map(children, (child) => {
62
- if (React.isValidElement(child)) {
63
- return React.cloneElement(child, { size: props.size } as any)
64
- }
65
- return child
66
- })}
67
- </CardStyled>
68
- )
47
+ return <CardStyled {...props}>{children}</CardStyled>;
69
48
  }
@@ -1,89 +1,89 @@
1
- import { ComponentProps, ReactNode } from 'react'
2
- import { styled } from '../styles'
3
- import { TextField as TextFieldRadix } from '@radix-ui/themes'
4
- import Icon from './Icon'
5
- import { typographyValues } from '../types/typographyValues'
6
- import { TextStyle } from './Text'
7
- import { Flex } from './Flex'
8
- import { format, MaskOptions, useMask, unformat } from '@react-input/mask'
1
+ import React, { ComponentProps, ReactNode } from "react";
2
+ import { styled } from "../styles";
3
+ import { TextField as TextFieldRadix } from "@radix-ui/themes";
4
+ import Icon from "./Icon";
5
+ import { typographyValues } from "../types/typographyValues";
6
+ import { TextStyle } from "./Text";
7
+ import { Flex } from "./Flex";
8
+ import { format, MaskOptions, useMask, unformat } from "@react-input/mask";
9
9
 
10
10
  export const TextFieldStyled = styled(TextFieldRadix.Root, {
11
- height: '$40',
12
- fontFamily: '$default',
13
- borderRadius: '$sm',
14
- boxSizing: 'border-box',
15
- color: '$dark500',
16
- border: '1px solid $dark300',
17
- position: 'relative',
18
- display: 'flex',
19
- width: '100%',
20
- alignItems: 'center',
21
- padding: '0 $14',
22
- gap: '$14',
11
+ height: "$40",
12
+ fontFamily: "$default",
13
+ borderRadius: "$sm",
14
+ boxSizing: "border-box",
15
+ color: "$dark500",
16
+ border: "1px solid $dark300",
17
+ position: "relative",
18
+ display: "flex",
19
+ width: "100%",
20
+ alignItems: "center",
21
+ padding: "0 $14",
22
+ gap: "$14",
23
23
  input: {
24
24
  order: 1,
25
- outline: 'none',
26
- border: 'none',
25
+ outline: "none",
26
+ border: "none",
27
27
  margin: 0,
28
- width: '100%',
29
- font: 'inherit',
30
- textAlign: 'left',
28
+ width: "100%",
29
+ font: "inherit",
30
+ textAlign: "left",
31
31
  },
32
32
 
33
- '&:has(input:focus)': {
34
- border: '2px solid $brand300',
33
+ "&:has(input:focus)": {
34
+ border: "2px solid $brand300",
35
35
  },
36
- '&:has(input:disabled)': {
37
- backgroundColor: '$dark100',
38
- color: '$dark400',
39
- border: '1px solid $dark200',
40
- cursor: 'not-allowed',
36
+ "&:has(input:disabled)": {
37
+ backgroundColor: "$dark100",
38
+ color: "$dark400",
39
+ border: "1px solid $dark200",
40
+ cursor: "not-allowed",
41
41
  },
42
42
 
43
43
  variants: {
44
44
  color: {
45
45
  default: {
46
- color: '$dark400',
47
- border: '1px solid $dark200',
48
- '&:has(input:focus)': {
49
- border: '2px solid $brand300',
46
+ color: "$dark400",
47
+ border: "1px solid $dark200",
48
+ "&:has(input:focus)": {
49
+ border: "2px solid $brand300",
50
50
  },
51
- '&:has(input:disabled)': {
52
- backgroundColor: '$dark100',
53
- color: '$dark400',
54
- border: '1px solid $dark200',
55
- cursor: 'not-allowed',
51
+ "&:has(input:disabled)": {
52
+ backgroundColor: "$dark100",
53
+ color: "$dark400",
54
+ border: "1px solid $dark200",
55
+ cursor: "not-allowed",
56
56
  },
57
57
  },
58
58
  error: {
59
- border: '1px solid $error400',
60
- color: '$error400',
61
- 'input::placeholder': {
62
- color: '$error400',
59
+ border: "1px solid $error400",
60
+ color: "$error400",
61
+ "input::placeholder": {
62
+ color: "$error400",
63
63
  },
64
- '&:has(input:focus)': {
65
- border: '2px solid $error400',
64
+ "&:has(input:focus)": {
65
+ border: "2px solid $error400",
66
66
  },
67
- '&:has(input:disabled)': {
68
- backgroundColor: '$error50',
69
- color: '$error300',
70
- border: '1px solid $error100',
71
- cursor: 'not-allowed',
67
+ "&:has(input:disabled)": {
68
+ backgroundColor: "$error50",
69
+ color: "$error300",
70
+ border: "1px solid $error100",
71
+ cursor: "not-allowed",
72
72
  },
73
73
  },
74
74
  },
75
75
 
76
76
  typography: typographyValues,
77
77
  fontWeight: {
78
- regular: { fontWeight: '$regular' },
79
- medium: { fontWeight: '$medium' },
80
- semibold: { fontWeight: '$semibold' },
81
- bold: { fontWeight: '$bold' },
78
+ regular: { fontWeight: "$regular" },
79
+ medium: { fontWeight: "$medium" },
80
+ semibold: { fontWeight: "$semibold" },
81
+ bold: { fontWeight: "$bold" },
82
82
  },
83
83
  textAlign: {
84
- left: { textAlign: 'left' },
85
- center: { textAlign: 'center' },
86
- right: { textAlign: 'right' },
84
+ left: { textAlign: "left" },
85
+ center: { textAlign: "center" },
86
+ right: { textAlign: "right" },
87
87
  },
88
88
  isValid: {
89
89
  true: {},
@@ -95,114 +95,114 @@ export const TextFieldStyled = styled(TextFieldRadix.Root, {
95
95
  {
96
96
  isValid: false,
97
97
  css: {
98
- border: '1px solid $error400',
99
- color: '$error400',
100
- backgroundColor: '$error50',
98
+ border: "1px solid $error400",
99
+ color: "$error400",
100
+ backgroundColor: "$error50",
101
101
  input: {
102
- '&::placeholder': {
103
- color: '$error400',
102
+ "&::placeholder": {
103
+ color: "$error400",
104
104
  },
105
- backgroundColor: '$error50',
105
+ backgroundColor: "$error50",
106
106
  },
107
- '&:has(input:focus)': {
108
- border: '2px solid $error400',
107
+ "&:has(input:focus)": {
108
+ border: "2px solid $error400",
109
109
  },
110
- '&:has(input:disabled)': {
110
+ "&:has(input:disabled)": {
111
111
  input: {
112
- backgroundColor: '$error50',
112
+ backgroundColor: "$error50",
113
113
  },
114
- backgroundColor: '$error50',
115
- color: '$error300',
116
- border: '1px solid $error100',
117
- cursor: 'not-allowed',
114
+ backgroundColor: "$error50",
115
+ color: "$error300",
116
+ border: "1px solid $error100",
117
+ cursor: "not-allowed",
118
118
  },
119
119
  },
120
120
  },
121
121
  {
122
122
  isValid: true,
123
123
  css: {
124
- '&:has(input:focus)': {
125
- border: '2px solid $success500',
124
+ "&:has(input:focus)": {
125
+ border: "2px solid $success500",
126
126
  },
127
- '&:has(input:disabled)': {
128
- backgroundColor: '$dark100',
129
- color: '$dark400',
130
- border: '1px solid $dark200',
131
- cursor: 'not-allowed',
127
+ "&:has(input:disabled)": {
128
+ backgroundColor: "$dark100",
129
+ color: "$dark400",
130
+ border: "1px solid $dark200",
131
+ cursor: "not-allowed",
132
132
  },
133
133
  },
134
134
  },
135
135
  ],
136
- })
136
+ });
137
137
 
138
138
  export const TextFieldSlotStyled = styled(TextFieldRadix.Slot, {
139
- display: 'flex',
140
- alignItems: 'center',
141
- justifyContent: 'center',
139
+ display: "flex",
140
+ alignItems: "center",
141
+ justifyContent: "center",
142
142
  padding: 4,
143
143
 
144
144
  variants: {
145
145
  typography: typographyValues,
146
146
  fontWeight: {
147
- regular: { fontWeight: '$regular' },
148
- medium: { fontWeight: '$medium' },
149
- semibold: { fontWeight: '$semibold' },
150
- bold: { fontWeight: '$bold' },
147
+ regular: { fontWeight: "$regular" },
148
+ medium: { fontWeight: "$medium" },
149
+ semibold: { fontWeight: "$semibold" },
150
+ bold: { fontWeight: "$bold" },
151
151
  },
152
152
  textAlign: {
153
- left: { textAlign: 'left' },
154
- right: { textAlign: 'right' },
155
- center: { textAlign: 'center' },
153
+ left: { textAlign: "left" },
154
+ right: { textAlign: "right" },
155
+ center: { textAlign: "center" },
156
156
  },
157
157
  },
158
- })
158
+ });
159
159
 
160
160
  export type TextFieldProps = ComponentProps<typeof TextFieldStyled> & {
161
- addon?: ReactNode
162
- placeholder?: string
163
- children?: React.ReactNode
164
- isValid?: boolean
165
- name?: string
166
- typography?: string
167
- fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold'
168
- textAlign?: 'left' | 'right' | 'center'
169
- mask?: MaskOptions
170
- }
161
+ addon?: ReactNode;
162
+ placeholder?: string;
163
+ children?: React.ReactNode;
164
+ isValid?: boolean;
165
+ name?: string;
166
+ typography?: string;
167
+ fontWeight?: "regular" | "medium" | "semibold" | "bold";
168
+ textAlign?: "left" | "right" | "center";
169
+ mask?: MaskOptions;
170
+ };
171
171
 
172
172
  export type TextFieldSlotProps = Omit<
173
173
  ComponentProps<typeof TextFieldStyled>,
174
- 'color'
174
+ "color"
175
175
  > & {
176
- placeholder?: string
177
- children?: React.ReactNode
178
- position?: 'flex-start' | 'flex-end'
179
- onClick?: () => void
180
- color?: 'error' | 'success' | undefined
181
- typography?: string
182
- fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold'
183
- textAlign?: 'left' | 'right' | 'center'
184
- }
176
+ placeholder?: string;
177
+ children?: React.ReactNode;
178
+ position?: "flex-start" | "flex-end";
179
+ onClick?: () => void;
180
+ color?: "error" | "success" | undefined;
181
+ typography?: string;
182
+ fontWeight?: "regular" | "medium" | "semibold" | "bold";
183
+ textAlign?: "left" | "right" | "center";
184
+ };
185
185
 
186
186
  const InputAddon = styled(TextStyle, {
187
- boxSizing: 'border-box',
188
- border: '1px solid $dark300',
189
- height: '$40',
190
- padding: '0 $12',
191
- margin: '0 auto',
187
+ boxSizing: "border-box",
188
+ border: "1px solid $dark300",
189
+ height: "$40",
190
+ padding: "0 $12",
191
+ margin: "0 auto",
192
192
 
193
- color: '$dark600',
194
- whiteSpace: 'nowrap',
195
- borderRadius: '$sm 0px 0px $sm',
196
- borderRightWidth: '0px',
197
- display: 'flex',
198
- flexWrap: 'nowrap',
199
- alignItems: 'center',
193
+ color: "$dark600",
194
+ whiteSpace: "nowrap",
195
+ borderRadius: "$sm 0px 0px $sm",
196
+ borderRightWidth: "0px",
197
+ display: "flex",
198
+ flexWrap: "nowrap",
199
+ alignItems: "center",
200
200
  lineHeight: 1,
201
- })
202
- export const maskFormat = format
203
- export const maskUnformat = unformat
201
+ });
202
+ export const maskFormat = format;
203
+ export const maskUnformat = unformat;
204
204
 
205
- export function TextField({
205
+ export const TextField = ({
206
206
  children,
207
207
  isValid,
208
208
  name,
@@ -210,14 +210,15 @@ export function TextField({
210
210
  typography,
211
211
  fontWeight,
212
212
  addon,
213
- textAlign = 'left',
213
+ textAlign = "left",
214
214
  mask,
215
+ ref,
215
216
  ...props
216
- }: TextFieldProps) {
217
- const maskRef = mask ? useMask(mask) : undefined
217
+ }: TextFieldProps) => {
218
+ const maskRef = mask ? useMask(mask) : undefined;
218
219
 
219
220
  return (
220
- <Flex gap={'0'} css={{ width: '100%' }}>
221
+ <Flex gap={"0"} css={{ width: "100%" }}>
221
222
  {!!addon && <InputAddon typography="labelSmall">{addon}</InputAddon>}
222
223
 
223
224
  <TextFieldStyled
@@ -227,11 +228,18 @@ export function TextField({
227
228
  typography={typography}
228
229
  fontWeight={fontWeight}
229
230
  textAlign={textAlign}
230
- ref={maskRef}
231
+ ref={(r) => {
232
+ if (!r) return;
233
+ if (maskRef) maskRef.current = r;
234
+ if (ref) {
235
+ if (typeof ref === "function") ref(r);
236
+ else ref.current = r;
237
+ }
238
+ }}
231
239
  {...props}
232
240
  style={
233
241
  addon
234
- ? { borderTopLeftRadius: '0px', borderBottomLeftRadius: '0px' }
242
+ ? { borderTopLeftRadius: "0px", borderBottomLeftRadius: "0px" }
235
243
  : undefined
236
244
  }
237
245
  >
@@ -240,7 +248,7 @@ export function TextField({
240
248
  <TextFieldSlot
241
249
  position="flex-end"
242
250
  name={name}
243
- color={color as TextFieldSlotProps['color']}
251
+ color={color as TextFieldSlotProps["color"]}
244
252
  typography={typography}
245
253
  fontWeight={fontWeight}
246
254
  textAlign={textAlign}
@@ -250,16 +258,16 @@ export function TextField({
250
258
  )}
251
259
  </TextFieldStyled>
252
260
  </Flex>
253
- )
254
- }
261
+ );
262
+ };
255
263
 
256
264
  export function TextFieldSlot({
257
265
  children,
258
- position = 'flex-start',
266
+ position = "flex-start",
259
267
  onClick,
260
- typography = 'bodyXS',
261
- fontWeight = 'regular',
262
- textAlign = 'right',
268
+ typography = "bodyXS",
269
+ fontWeight = "regular",
270
+ textAlign = "right",
263
271
  ...props
264
272
  }: TextFieldSlotProps) {
265
273
  const sharedStyles = {
@@ -268,17 +276,17 @@ export function TextFieldSlot({
268
276
  textAlign,
269
277
  ...props,
270
278
  color: undefined,
271
- }
279
+ };
272
280
 
273
281
  return onClick ? (
274
282
  <TextFieldSlotStyled
275
283
  {...sharedStyles}
276
284
  style={{
277
- float: position === 'flex-start' ? 'left' : 'right',
278
- order: position === 'flex-start' ? 0 : 2,
285
+ float: position === "flex-start" ? "left" : "right",
286
+ order: position === "flex-start" ? 0 : 2,
279
287
  textAlign,
280
288
  zIndex: 2,
281
- cursor: 'pointer',
289
+ cursor: "pointer",
282
290
  }}
283
291
  onClick={() => onClick()}
284
292
  >
@@ -288,12 +296,12 @@ export function TextFieldSlot({
288
296
  <TextFieldSlotStyled
289
297
  {...sharedStyles}
290
298
  style={{
291
- float: position === 'flex-start' ? 'left' : 'right',
292
- order: position === 'flex-start' ? 0 : 2,
299
+ float: position === "flex-start" ? "left" : "right",
300
+ order: position === "flex-start" ? 0 : 2,
293
301
  textAlign,
294
302
  }}
295
303
  >
296
304
  {children}
297
305
  </TextFieldSlotStyled>
298
- )
306
+ );
299
307
  }