@ttoss/ui 1.31.16 → 1.31.18

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,23 +327,89 @@ 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
347
386
  });
348
387
  };
349
- export { Badge, BaseStyles, Box, Button, Card, Checkbox, 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 };
388
+
389
+ // src/components/CloseButton.tsx
390
+ import { Button as Button2 } from "theme-ui";
391
+ import React9 from "react";
392
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
393
+ var CloseButton = /*#__PURE__*/React9.forwardRef(({
394
+ label,
395
+ sx,
396
+ ...props
397
+ }, ref) => {
398
+ return /* @__PURE__ */jsxs8(Button2, {
399
+ variant: "buttons.closeButton",
400
+ type: "button",
401
+ "aria-label": label,
402
+ sx: {
403
+ gap: "sm",
404
+ padding: 0,
405
+ ...sx
406
+ },
407
+ ...props,
408
+ ref,
409
+ children: [label, /* @__PURE__ */jsx12(Icon, {
410
+ icon: "close"
411
+ })]
412
+ });
413
+ });
414
+ CloseButton.displayName = "CloseButton";
415
+ 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 };
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 } 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,10 +53,20 @@ 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;
59
64
  };
60
65
  declare const HelpText: ({ disabled, negative, ...props }: HelpTextProps) => JSX.Element;
61
66
 
62
- export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconButton, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, ThemeProvider, ThemeProviderProps, useTheme };
67
+ type CloseButtonProps = ButtonProps$1 & {
68
+ label?: string;
69
+ };
70
+ declare const CloseButton: React__default.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
71
+
72
+ export { Badge, BadgeProps, Button, ButtonProps, CloseButton, CloseButtonProps, HelpText, HelpTextProps, Icon, IconButton, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, Textarea, TextareaProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -39,11 +39,12 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
39
39
  var src_exports = {};
40
40
  __export(src_exports, {
41
41
  Badge: () => Badge,
42
- BaseStyles: () => import_theme_ui25.BaseStyles,
42
+ BaseStyles: () => import_theme_ui26.BaseStyles,
43
43
  Box: () => import_theme_ui4.Box,
44
44
  Button: () => Button,
45
45
  Card: () => import_theme_ui6.Card,
46
46
  Checkbox: () => import_theme_ui22.Checkbox,
47
+ CloseButton: () => CloseButton,
47
48
  Container: () => import_theme_ui24.Container,
48
49
  Divider: () => import_theme_ui7.Divider,
49
50
  Flex: () => import_theme_ui8.Flex,
@@ -63,14 +64,14 @@ __export(src_exports, {
63
64
  Slider: () => import_theme_ui21.Slider,
64
65
  Spinner: () => import_theme_ui18.Spinner,
65
66
  Text: () => import_theme_ui16.Text,
66
- Textarea: () => import_theme_ui23.Textarea,
67
+ Textarea: () => Textarea,
67
68
  ThemeProvider: () => ThemeProvider,
68
69
  useBreakpointIndex: () => import_match_media.useBreakpointIndex,
69
70
  useResponsiveValue: () => import_match_media.useResponsiveValue,
70
71
  useTheme: () => useTheme
71
72
  });
72
73
  module.exports = __toCommonJS(src_exports);
73
- var import_theme_ui25 = require("theme-ui");
74
+ var import_theme_ui26 = require("theme-ui");
74
75
  var import_match_media = require("@theme-ui/match-media");
75
76
 
76
77
  // src/theme/ThemeProvider.tsx
@@ -397,24 +398,90 @@ var InfiniteLinearProgress = () => {
397
398
 
398
399
  // src/components/Textarea.tsx
399
400
  var import_theme_ui23 = require("theme-ui");
401
+ var import_react5 = __toESM(require("react"));
402
+ var import_jsx_runtime10 = require("react/jsx-runtime");
403
+ var Textarea = import_react5.default.forwardRef(({
404
+ trailingIcon,
405
+ className,
406
+ sx,
407
+ ...textareaProps
408
+ }, ref) => {
409
+ return /* @__PURE__ */(0, import_jsx_runtime10.jsxs)(import_theme_ui8.Flex, {
410
+ className,
411
+ sx: {
412
+ ...sx,
413
+ position: "relative",
414
+ padding: 0,
415
+ border: "none"
416
+ },
417
+ children: [/* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui23.Textarea, {
418
+ ref,
419
+ sx: {
420
+ ...sx,
421
+ paddingRight: trailingIcon ? "3xl" : void 0,
422
+ margin: 0
423
+ },
424
+ className,
425
+ ...textareaProps
426
+ }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui16.Text, {
427
+ sx: {
428
+ position: "absolute",
429
+ right: "1.25rem",
430
+ top: "0.75rem"
431
+ },
432
+ children: /* @__PURE__ */(0, import_jsx_runtime10.jsx)(Icon, {
433
+ inline: true,
434
+ icon: trailingIcon
435
+ })
436
+ })]
437
+ });
438
+ });
439
+ Textarea.displayName = "Textarea";
400
440
 
401
441
  // src/components/Container.tsx
402
442
  var import_theme_ui24 = require("theme-ui");
403
443
 
404
444
  // src/components/HelpText.tsx
405
- var import_jsx_runtime10 = require("react/jsx-runtime");
445
+ var import_jsx_runtime11 = require("react/jsx-runtime");
406
446
  var HelpText = ({
407
447
  disabled,
408
448
  negative,
409
449
  ...props
410
450
  }) => {
411
451
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
412
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui16.Text, {
452
+ return /* @__PURE__ */(0, import_jsx_runtime11.jsx)(import_theme_ui16.Text, {
413
453
  variant,
414
454
  "aria-disabled": disabled ? "true" : void 0,
415
455
  ...props
416
456
  });
417
457
  };
458
+
459
+ // src/components/CloseButton.tsx
460
+ var import_theme_ui25 = require("theme-ui");
461
+ var import_react6 = __toESM(require("react"));
462
+ var import_jsx_runtime12 = require("react/jsx-runtime");
463
+ var CloseButton = import_react6.default.forwardRef(({
464
+ label,
465
+ sx,
466
+ ...props
467
+ }, ref) => {
468
+ return /* @__PURE__ */(0, import_jsx_runtime12.jsxs)(import_theme_ui25.Button, {
469
+ variant: "buttons.closeButton",
470
+ type: "button",
471
+ "aria-label": label,
472
+ sx: {
473
+ gap: "sm",
474
+ padding: 0,
475
+ ...sx
476
+ },
477
+ ...props,
478
+ ref,
479
+ children: [label, /* @__PURE__ */(0, import_jsx_runtime12.jsx)(Icon, {
480
+ icon: "close"
481
+ })]
482
+ });
483
+ });
484
+ CloseButton.displayName = "CloseButton";
418
485
  // Annotate the CommonJS export names for ESM import in node:
419
486
  0 && (module.exports = {
420
487
  Badge,
@@ -423,6 +490,7 @@ var HelpText = ({
423
490
  Button,
424
491
  Card,
425
492
  Checkbox,
493
+ CloseButton,
426
494
  Container,
427
495
  Divider,
428
496
  Flex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.16",
3
+ "version": "1.31.18",
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.13",
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": "aa31505953d2717d84fa5e69dbae5b488ef04986"
49
+ "gitHead": "3f398d2717a3ac8f7fecf4c79c028b35f0ef45fb"
50
50
  }
@@ -0,0 +1,29 @@
1
+ import { Button, type ButtonProps } from 'theme-ui';
2
+ import { Icon } from './Icon';
3
+ import React from 'react';
4
+
5
+ export type CloseButtonProps = ButtonProps & {
6
+ label?: string;
7
+ };
8
+
9
+ export const CloseButton = React.forwardRef<
10
+ HTMLButtonElement,
11
+ CloseButtonProps
12
+ >(({ label, sx, ...props }, ref) => {
13
+ return (
14
+ <Button
15
+ variant="buttons.closeButton"
16
+ type="button"
17
+ aria-label={label}
18
+ sx={{ gap: 'sm', padding: 0, ...sx }}
19
+ {...props}
20
+ ref={ref}
21
+ >
22
+ {label}
23
+
24
+ <Icon icon="close" />
25
+ </Button>
26
+ );
27
+ });
28
+
29
+ CloseButton.displayName = 'CloseButton';
@@ -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
@@ -33,3 +33,4 @@ export { InfiniteLinearProgress } from './components/InfiniteLinearProgress';
33
33
  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
+ export { CloseButton, type CloseButtonProps } from './components/CloseButton';