@ttoss/ui 1.31.17 → 1.32.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.
package/dist/esm/index.js CHANGED
@@ -327,20 +327,59 @@ var InfiniteLinearProgress = () => {
327
327
  };
328
328
 
329
329
  // src/components/Textarea.tsx
330
- import { Textarea } from "theme-ui";
330
+ import { Textarea as TextareaUI } from "theme-ui";
331
+ import React8 from "react";
332
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
333
+ var Textarea = /*#__PURE__*/React8.forwardRef(({
334
+ trailingIcon,
335
+ className,
336
+ sx,
337
+ ...textareaProps
338
+ }, ref) => {
339
+ return /* @__PURE__ */jsxs7(Flex, {
340
+ className,
341
+ sx: {
342
+ ...sx,
343
+ position: "relative",
344
+ padding: 0,
345
+ border: "none"
346
+ },
347
+ children: [/* @__PURE__ */jsx10(TextareaUI, {
348
+ ref,
349
+ sx: {
350
+ ...sx,
351
+ paddingRight: trailingIcon ? "3xl" : void 0,
352
+ margin: 0
353
+ },
354
+ className,
355
+ ...textareaProps
356
+ }), trailingIcon && /* @__PURE__ */jsx10(Text, {
357
+ sx: {
358
+ position: "absolute",
359
+ right: "1.25rem",
360
+ top: "0.75rem"
361
+ },
362
+ children: /* @__PURE__ */jsx10(Icon, {
363
+ inline: true,
364
+ icon: trailingIcon
365
+ })
366
+ })]
367
+ });
368
+ });
369
+ Textarea.displayName = "Textarea";
331
370
 
332
371
  // src/components/Container.tsx
333
372
  import { Container } from "theme-ui";
334
373
 
335
374
  // src/components/HelpText.tsx
336
- import { jsx as jsx10 } from "react/jsx-runtime";
375
+ import { jsx as jsx11 } from "react/jsx-runtime";
337
376
  var HelpText = ({
338
377
  disabled,
339
378
  negative,
340
379
  ...props
341
380
  }) => {
342
381
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
343
- return /* @__PURE__ */jsx10(Text, {
382
+ return /* @__PURE__ */jsx11(Text, {
344
383
  variant,
345
384
  "aria-disabled": disabled ? "true" : void 0,
346
385
  ...props
@@ -349,14 +388,14 @@ var HelpText = ({
349
388
 
350
389
  // src/components/CloseButton.tsx
351
390
  import { Button as Button2 } from "theme-ui";
352
- import React8 from "react";
353
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
354
- var CloseButton = /*#__PURE__*/React8.forwardRef(({
391
+ import React9 from "react";
392
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
393
+ var CloseButton = /*#__PURE__*/React9.forwardRef(({
355
394
  label,
356
395
  sx,
357
396
  ...props
358
397
  }, ref) => {
359
- return /* @__PURE__ */jsxs7(Button2, {
398
+ return /* @__PURE__ */jsxs8(Button2, {
360
399
  variant: "buttons.closeButton",
361
400
  type: "button",
362
401
  "aria-label": label,
@@ -367,10 +406,25 @@ var CloseButton = /*#__PURE__*/React8.forwardRef(({
367
406
  },
368
407
  ...props,
369
408
  ref,
370
- children: [label, /* @__PURE__ */jsx11(Icon, {
409
+ children: [label, /* @__PURE__ */jsx12(Icon, {
371
410
  icon: "close"
372
411
  })]
373
412
  });
374
413
  });
375
414
  CloseButton.displayName = "CloseButton";
376
- export { Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Grid, Heading, HelpText, Icon, IconButton, Image, InfiniteLinearProgress, Input, Label, Progress as LinearProgress, Link, Radio, Select, Slider, Spinner, Text, Textarea, ThemeProvider, useBreakpointIndex, useResponsiveValue, useTheme };
415
+
416
+ // src/components/Stack.tsx
417
+ import * as React10 from "react";
418
+ import { jsx as jsx13 } from "react/jsx-runtime";
419
+ var Stack = /*#__PURE__*/React10.forwardRef((props, ref) => {
420
+ return /* @__PURE__ */jsx13(Flex, {
421
+ ref,
422
+ ...props,
423
+ sx: {
424
+ flexDirection: "column",
425
+ ...props.sx
426
+ }
427
+ });
428
+ });
429
+ Stack.displayName = "Stack";
430
+ export { Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Grid, Heading, HelpText, Icon, IconButton, Image, InfiniteLinearProgress, Input, Label, Progress as LinearProgress, Link, Radio, Select, Slider, Spinner, Stack, Text, Textarea, ThemeProvider, useBreakpointIndex, useResponsiveValue, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as theme_ui from 'theme-ui';
2
- import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, SelectProps as SelectProps$1, IconButtonProps, TextProps } from 'theme-ui';
3
- export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Textarea, TextareaProps, Theme } from 'theme-ui';
2
+ import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, SelectProps as SelectProps$1, IconButtonProps, TextareaProps as TextareaProps$1, TextProps, FlexProps } from 'theme-ui';
3
+ export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Theme } from 'theme-ui';
4
4
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
@@ -53,6 +53,11 @@ declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps,
53
53
 
54
54
  declare const InfiniteLinearProgress: () => JSX.Element;
55
55
 
56
+ type TextareaProps = TextareaProps$1 & {
57
+ trailingIcon?: IconType;
58
+ };
59
+ declare const Textarea: React__default.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React__default.RefAttributes<HTMLTextAreaElement>>;
60
+
56
61
  type HelpTextProps = Omit<TextProps, 'variant'> & {
57
62
  disabled?: boolean;
58
63
  negative?: boolean;
@@ -64,4 +69,10 @@ type CloseButtonProps = ButtonProps$1 & {
64
69
  };
65
70
  declare const CloseButton: React__default.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
66
71
 
67
- export { Badge, BadgeProps, Button, ButtonProps, CloseButton, CloseButtonProps, HelpText, HelpTextProps, Icon, IconButton, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, ThemeProvider, ThemeProviderProps, useTheme };
72
+ type StackProps = FlexProps;
73
+ /**
74
+ * A component that renders its children in a column.
75
+ */
76
+ declare const Stack: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLElement>>;
77
+
78
+ export { Badge, BadgeProps, Button, ButtonProps, CloseButton, CloseButtonProps, HelpText, HelpTextProps, Icon, IconButton, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, Stack, StackProps, Textarea, TextareaProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -63,8 +63,9 @@ __export(src_exports, {
63
63
  Select: () => Select,
64
64
  Slider: () => import_theme_ui21.Slider,
65
65
  Spinner: () => import_theme_ui18.Spinner,
66
+ Stack: () => Stack,
66
67
  Text: () => import_theme_ui16.Text,
67
- Textarea: () => import_theme_ui23.Textarea,
68
+ Textarea: () => Textarea,
68
69
  ThemeProvider: () => ThemeProvider,
69
70
  useBreakpointIndex: () => import_match_media.useBreakpointIndex,
70
71
  useResponsiveValue: () => import_match_media.useResponsiveValue,
@@ -398,19 +399,58 @@ var InfiniteLinearProgress = () => {
398
399
 
399
400
  // src/components/Textarea.tsx
400
401
  var import_theme_ui23 = require("theme-ui");
402
+ var import_react5 = __toESM(require("react"));
403
+ var import_jsx_runtime10 = require("react/jsx-runtime");
404
+ var Textarea = import_react5.default.forwardRef(({
405
+ trailingIcon,
406
+ className,
407
+ sx,
408
+ ...textareaProps
409
+ }, ref) => {
410
+ return /* @__PURE__ */(0, import_jsx_runtime10.jsxs)(import_theme_ui8.Flex, {
411
+ className,
412
+ sx: {
413
+ ...sx,
414
+ position: "relative",
415
+ padding: 0,
416
+ border: "none"
417
+ },
418
+ children: [/* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui23.Textarea, {
419
+ ref,
420
+ sx: {
421
+ ...sx,
422
+ paddingRight: trailingIcon ? "3xl" : void 0,
423
+ margin: 0
424
+ },
425
+ className,
426
+ ...textareaProps
427
+ }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui16.Text, {
428
+ sx: {
429
+ position: "absolute",
430
+ right: "1.25rem",
431
+ top: "0.75rem"
432
+ },
433
+ children: /* @__PURE__ */(0, import_jsx_runtime10.jsx)(Icon, {
434
+ inline: true,
435
+ icon: trailingIcon
436
+ })
437
+ })]
438
+ });
439
+ });
440
+ Textarea.displayName = "Textarea";
401
441
 
402
442
  // src/components/Container.tsx
403
443
  var import_theme_ui24 = require("theme-ui");
404
444
 
405
445
  // src/components/HelpText.tsx
406
- var import_jsx_runtime10 = require("react/jsx-runtime");
446
+ var import_jsx_runtime11 = require("react/jsx-runtime");
407
447
  var HelpText = ({
408
448
  disabled,
409
449
  negative,
410
450
  ...props
411
451
  }) => {
412
452
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
413
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui16.Text, {
453
+ return /* @__PURE__ */(0, import_jsx_runtime11.jsx)(import_theme_ui16.Text, {
414
454
  variant,
415
455
  "aria-disabled": disabled ? "true" : void 0,
416
456
  ...props
@@ -419,14 +459,14 @@ var HelpText = ({
419
459
 
420
460
  // src/components/CloseButton.tsx
421
461
  var import_theme_ui25 = require("theme-ui");
422
- var import_react5 = __toESM(require("react"));
423
- var import_jsx_runtime11 = require("react/jsx-runtime");
424
- var CloseButton = import_react5.default.forwardRef(({
462
+ var import_react6 = __toESM(require("react"));
463
+ var import_jsx_runtime12 = require("react/jsx-runtime");
464
+ var CloseButton = import_react6.default.forwardRef(({
425
465
  label,
426
466
  sx,
427
467
  ...props
428
468
  }, ref) => {
429
- return /* @__PURE__ */(0, import_jsx_runtime11.jsxs)(import_theme_ui25.Button, {
469
+ return /* @__PURE__ */(0, import_jsx_runtime12.jsxs)(import_theme_ui25.Button, {
430
470
  variant: "buttons.closeButton",
431
471
  type: "button",
432
472
  "aria-label": label,
@@ -437,12 +477,27 @@ var CloseButton = import_react5.default.forwardRef(({
437
477
  },
438
478
  ...props,
439
479
  ref,
440
- children: [label, /* @__PURE__ */(0, import_jsx_runtime11.jsx)(Icon, {
480
+ children: [label, /* @__PURE__ */(0, import_jsx_runtime12.jsx)(Icon, {
441
481
  icon: "close"
442
482
  })]
443
483
  });
444
484
  });
445
485
  CloseButton.displayName = "CloseButton";
486
+
487
+ // src/components/Stack.tsx
488
+ var React10 = __toESM(require("react"));
489
+ var import_jsx_runtime13 = require("react/jsx-runtime");
490
+ var Stack = React10.forwardRef((props, ref) => {
491
+ return /* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_theme_ui8.Flex, {
492
+ ref,
493
+ ...props,
494
+ sx: {
495
+ flexDirection: "column",
496
+ ...props.sx
497
+ }
498
+ });
499
+ });
500
+ Stack.displayName = "Stack";
446
501
  // Annotate the CommonJS export names for ESM import in node:
447
502
  0 && (module.exports = {
448
503
  Badge,
@@ -470,6 +525,7 @@ CloseButton.displayName = "CloseButton";
470
525
  Select,
471
526
  Slider,
472
527
  Spinner,
528
+ Stack,
473
529
  Text,
474
530
  Textarea,
475
531
  ThemeProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.17",
3
+ "version": "1.32.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -24,7 +24,7 @@
24
24
  "@emotion/react": "^11.10.6",
25
25
  "@iconify-icon/react": "^1.0.7",
26
26
  "@theme-ui/match-media": "^0.15.7",
27
- "@ttoss/theme": "^1.4.14",
27
+ "@ttoss/theme": "^1.4.15",
28
28
  "theme-ui": "^0.15.7"
29
29
  },
30
30
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "f7ce64308917a032fdd64066b00d26f12702ef83"
49
+ "gitHead": "d8d388f73b22a40e68b59c3276bb2d3b2f486225"
50
50
  }
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import { Flex, FlexProps } from './Flex';
3
+
4
+ export type StackProps = FlexProps;
5
+
6
+ /**
7
+ * A component that renders its children in a column.
8
+ */
9
+ export const Stack = React.forwardRef<HTMLElement, StackProps>(
10
+ (props: FlexProps, ref) => {
11
+ return (
12
+ <Flex
13
+ ref={ref}
14
+ {...props}
15
+ sx={{
16
+ flexDirection: 'column',
17
+ ...props.sx,
18
+ }}
19
+ />
20
+ );
21
+ }
22
+ );
23
+
24
+ Stack.displayName = 'Stack';
@@ -1 +1,46 @@
1
- export { Textarea, type TextareaProps } from 'theme-ui';
1
+ import { Flex, Icon, type IconType, Text } from '..';
2
+ import {
3
+ type TextareaProps as TextareaPropsUI,
4
+ Textarea as TextareaUI,
5
+ } from 'theme-ui';
6
+ import React from 'react';
7
+
8
+ export type TextareaProps = TextareaPropsUI & {
9
+ trailingIcon?: IconType;
10
+ };
11
+
12
+ export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
13
+ ({ trailingIcon, className, sx, ...textareaProps }, ref) => {
14
+ return (
15
+ <Flex
16
+ className={className}
17
+ sx={{ ...sx, position: 'relative', padding: 0, border: 'none' }}
18
+ >
19
+ <TextareaUI
20
+ ref={ref}
21
+ sx={{
22
+ ...sx,
23
+ paddingRight: trailingIcon ? '3xl' : undefined,
24
+ margin: 0,
25
+ }}
26
+ className={className}
27
+ {...textareaProps}
28
+ />
29
+
30
+ {trailingIcon && (
31
+ <Text
32
+ sx={{
33
+ position: 'absolute',
34
+ right: '1.25rem',
35
+ top: '0.75rem',
36
+ }}
37
+ >
38
+ <Icon inline icon={trailingIcon} />
39
+ </Text>
40
+ )}
41
+ </Flex>
42
+ );
43
+ }
44
+ );
45
+
46
+ Textarea.displayName = 'Textarea';
package/src/index.ts CHANGED
@@ -34,3 +34,4 @@ export { Textarea, type TextareaProps } from './components/Textarea';
34
34
  export { Container, type ContainerProps } from './components/Container';
35
35
  export { HelpText, type HelpTextProps } from './components/HelpText';
36
36
  export { CloseButton, type CloseButtonProps } from './components/CloseButton';
37
+ export { Stack, type StackProps } from './components/Stack';