@ttoss/ui 3.1.3 → 3.1.5

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/esm/index.js CHANGED
@@ -266,6 +266,16 @@ var Select = /*#__PURE__*/React4.forwardRef(({
266
266
  ...props
267
267
  }, ref) => {
268
268
  const hasError = props["aria-invalid"] === "true";
269
+ const refEl = React4.useRef({});
270
+ React4.useImperativeHandle(ref, () => {
271
+ return refEl.current;
272
+ });
273
+ React4.useEffect(() => {
274
+ const parentEl = refEl.current?.parentElement;
275
+ if (parentEl) {
276
+ parentEl.style.position = "relative";
277
+ }
278
+ }, []);
269
279
  return /* @__PURE__ */jsx7(SelectUi, {
270
280
  arrow: /* @__PURE__ */jsxs6(Fragment2, {
271
281
  children: [leadingIcon && /* @__PURE__ */jsx7(Text, {
@@ -279,9 +289,8 @@ var Select = /*#__PURE__*/React4.forwardRef(({
279
289
  left: ({
280
290
  space
281
291
  }) => {
282
- const defaultLeftValue = "16px";
283
292
  const leftSpaceValue = space?.["xl"] || "16px";
284
- return `calc(${leftSpaceValue} + ${defaultLeftValue})`;
293
+ return leftSpaceValue;
285
294
  }
286
295
  },
287
296
  children: /* @__PURE__ */jsx7(Icon5, {
@@ -295,9 +304,8 @@ var Select = /*#__PURE__*/React4.forwardRef(({
295
304
  right: ({
296
305
  space
297
306
  }) => {
298
- const defaultRightValue = "16px";
299
307
  const xlSpace = space?.["xl"] || "16px";
300
- return `calc(${xlSpace} + ${defaultRightValue})`;
308
+ return xlSpace;
301
309
  },
302
310
  alignSelf: "center",
303
311
  pointerEvents: "none"
@@ -357,7 +365,7 @@ var Select = /*#__PURE__*/React4.forwardRef(({
357
365
  },
358
366
  ...sx
359
367
  },
360
- ref,
368
+ ref: refEl,
361
369
  ...props
362
370
  });
363
371
  });
package/dist/index.js CHANGED
@@ -342,6 +342,16 @@ var Select = React4.forwardRef(({
342
342
  ...props
343
343
  }, ref) => {
344
344
  const hasError = props["aria-invalid"] === "true";
345
+ const refEl = React4.useRef({});
346
+ React4.useImperativeHandle(ref, () => {
347
+ return refEl.current;
348
+ });
349
+ React4.useEffect(() => {
350
+ const parentEl = refEl.current?.parentElement;
351
+ if (parentEl) {
352
+ parentEl.style.position = "relative";
353
+ }
354
+ }, []);
345
355
  return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui17.Select, {
346
356
  arrow: /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, {
347
357
  children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
@@ -355,9 +365,8 @@ var Select = React4.forwardRef(({
355
365
  left: ({
356
366
  space
357
367
  }) => {
358
- const defaultLeftValue = "16px";
359
368
  const leftSpaceValue = space?.["xl"] || "16px";
360
- return `calc(${leftSpaceValue} + ${defaultLeftValue})`;
369
+ return leftSpaceValue;
361
370
  }
362
371
  },
363
372
  children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_icons5.Icon, {
@@ -371,9 +380,8 @@ var Select = React4.forwardRef(({
371
380
  right: ({
372
381
  space
373
382
  }) => {
374
- const defaultRightValue = "16px";
375
383
  const xlSpace = space?.["xl"] || "16px";
376
- return `calc(${xlSpace} + ${defaultRightValue})`;
384
+ return xlSpace;
377
385
  },
378
386
  alignSelf: "center",
379
387
  pointerEvents: "none"
@@ -433,7 +441,7 @@ var Select = React4.forwardRef(({
433
441
  },
434
442
  ...sx
435
443
  },
436
- ref,
444
+ ref: refEl,
437
445
  ...props
438
446
  });
439
447
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@theme-ui/match-media": "^0.16.0",
24
24
  "theme-ui": "^0.16.0",
25
- "@ttoss/theme": "^1.6.3"
25
+ "@ttoss/theme": "^1.6.4"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@emotion/react": "^11",
@@ -15,6 +15,20 @@ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
15
15
  ({ arrow, sx, leadingIcon, trailingIcon, ...props }, ref) => {
16
16
  const hasError = props['aria-invalid'] === 'true';
17
17
 
18
+ const refEl = React.useRef<HTMLSelectElement>({} as HTMLSelectElement);
19
+
20
+ React.useImperativeHandle(ref, () => {
21
+ return refEl.current;
22
+ });
23
+
24
+ React.useEffect(() => {
25
+ const parentEl = refEl.current?.parentElement;
26
+
27
+ if (parentEl) {
28
+ parentEl.style.position = 'relative';
29
+ }
30
+ }, []);
31
+
18
32
  return (
19
33
  <SelectUi
20
34
  // https://theme-ui.com/components/select#custom-arrow-icon
@@ -30,10 +44,9 @@ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
30
44
  position: 'absolute',
31
45
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
46
  left: ({ space }: any) => {
33
- const defaultLeftValue = '16px';
34
47
  const leftSpaceValue = space?.['xl'] || '16px';
35
48
 
36
- return `calc(${leftSpaceValue} + ${defaultLeftValue})`;
49
+ return leftSpaceValue;
37
50
  },
38
51
  }}
39
52
  >
@@ -47,10 +60,9 @@ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
47
60
  position: 'absolute',
48
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
62
  right: ({ space }: any) => {
50
- const defaultRightValue = '16px';
51
63
  const xlSpace = space?.['xl'] || '16px';
52
64
 
53
- return `calc(${xlSpace} + ${defaultRightValue})`;
65
+ return xlSpace;
54
66
  },
55
67
  alignSelf: 'center',
56
68
  pointerEvents: 'none',
@@ -116,7 +128,7 @@ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
116
128
  },
117
129
  ...sx,
118
130
  }}
119
- ref={ref}
131
+ ref={refEl}
120
132
  {...props}
121
133
  />
122
134
  );