@ttoss/ui 1.31.15 → 1.31.17

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
@@ -86,9 +86,9 @@ var Button = /*#__PURE__*/React3.forwardRef((props, ref) => {
86
86
  ...restProps
87
87
  } = props;
88
88
  return /* @__PURE__ */jsxs3(ButtonUi, {
89
- ref,
90
89
  type: "button",
91
90
  ...restProps,
91
+ ref,
92
92
  sx: {
93
93
  cursor: "pointer",
94
94
  paddingX: "xl",
@@ -274,7 +274,17 @@ import { Spinner } from "theme-ui";
274
274
  import { Radio } from "theme-ui";
275
275
 
276
276
  // src/components/IconButton.tsx
277
- import { IconButton } from "theme-ui";
277
+ import * as React6 from "react";
278
+ import { IconButton as IconButtonUi } from "theme-ui";
279
+ import { jsx as jsx8 } from "react/jsx-runtime";
280
+ var IconButton = /*#__PURE__*/React6.forwardRef((props, ref) => {
281
+ return /* @__PURE__ */jsx8(IconButtonUi, {
282
+ type: "button",
283
+ ...props,
284
+ ref
285
+ });
286
+ });
287
+ IconButton.displayName = "IconButton";
278
288
 
279
289
  // src/components/Slider.tsx
280
290
  import { Slider } from "theme-ui";
@@ -283,12 +293,12 @@ import { Slider } from "theme-ui";
283
293
  import { Checkbox } from "theme-ui";
284
294
 
285
295
  // src/components/InfiniteLinearProgress.tsx
286
- import * as React6 from "react";
287
- import { jsx as jsx8 } from "react/jsx-runtime";
296
+ import * as React7 from "react";
297
+ import { jsx as jsx9 } from "react/jsx-runtime";
288
298
  var MAX_PROGRESS = 100;
289
299
  var InfiniteLinearProgress = () => {
290
- const [progress, setProgress] = React6.useState(0);
291
- React6.useEffect(() => {
300
+ const [progress, setProgress] = React7.useState(0);
301
+ React7.useEffect(() => {
292
302
  const timer = setInterval(() => {
293
303
  setProgress(oldProgress => {
294
304
  if (oldProgress === MAX_PROGRESS) {
@@ -309,7 +319,7 @@ var InfiniteLinearProgress = () => {
309
319
  clearInterval(timer);
310
320
  };
311
321
  }, []);
312
- return /* @__PURE__ */jsx8(Progress, {
322
+ return /* @__PURE__ */jsx9(Progress, {
313
323
  max: MAX_PROGRESS,
314
324
  value: progress,
315
325
  role: "progressbar"
@@ -323,17 +333,44 @@ import { Textarea } from "theme-ui";
323
333
  import { Container } from "theme-ui";
324
334
 
325
335
  // src/components/HelpText.tsx
326
- import { jsx as jsx9 } from "react/jsx-runtime";
336
+ import { jsx as jsx10 } from "react/jsx-runtime";
327
337
  var HelpText = ({
328
338
  disabled,
329
339
  negative,
330
340
  ...props
331
341
  }) => {
332
342
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
333
- return /* @__PURE__ */jsx9(Text, {
343
+ return /* @__PURE__ */jsx10(Text, {
334
344
  variant,
335
345
  "aria-disabled": disabled ? "true" : void 0,
336
346
  ...props
337
347
  });
338
348
  };
339
- 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 };
349
+
350
+ // src/components/CloseButton.tsx
351
+ 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(({
355
+ label,
356
+ sx,
357
+ ...props
358
+ }, ref) => {
359
+ return /* @__PURE__ */jsxs7(Button2, {
360
+ variant: "buttons.closeButton",
361
+ type: "button",
362
+ "aria-label": label,
363
+ sx: {
364
+ gap: "sm",
365
+ padding: 0,
366
+ ...sx
367
+ },
368
+ ...props,
369
+ ref,
370
+ children: [label, /* @__PURE__ */jsx11(Icon, {
371
+ icon: "close"
372
+ })]
373
+ });
374
+ });
375
+ 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 };
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, TextProps } from 'theme-ui';
3
- export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButton, 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, 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';
4
4
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
@@ -49,6 +49,8 @@ declare const Label: ({ children, onTooltipClick, tooltip, ...props }: LabelProp
49
49
  type SelectProps = SelectProps$1;
50
50
  declare const Select: React__default.ForwardRefExoticComponent<Omit<SelectProps$1, "ref"> & React__default.RefAttributes<HTMLSelectElement>>;
51
51
 
52
+ declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
53
+
52
54
  declare const InfiniteLinearProgress: () => JSX.Element;
53
55
 
54
56
  type HelpTextProps = Omit<TextProps, 'variant'> & {
@@ -57,4 +59,9 @@ type HelpTextProps = Omit<TextProps, 'variant'> & {
57
59
  };
58
60
  declare const HelpText: ({ disabled, negative, ...props }: HelpTextProps) => JSX.Element;
59
61
 
60
- export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, ThemeProvider, ThemeProviderProps, useTheme };
62
+ type CloseButtonProps = ButtonProps$1 & {
63
+ label?: string;
64
+ };
65
+ declare const CloseButton: React__default.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
66
+
67
+ export { Badge, BadgeProps, Button, ButtonProps, CloseButton, CloseButtonProps, HelpText, HelpTextProps, Icon, IconButton, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, 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,
@@ -51,7 +52,7 @@ __export(src_exports, {
51
52
  Heading: () => import_theme_ui10.Heading,
52
53
  HelpText: () => HelpText,
53
54
  Icon: () => Icon,
54
- IconButton: () => import_theme_ui20.IconButton,
55
+ IconButton: () => IconButton,
55
56
  Image: () => import_theme_ui11.Image,
56
57
  InfiniteLinearProgress: () => InfiniteLinearProgress,
57
58
  Input: () => Input,
@@ -70,7 +71,7 @@ __export(src_exports, {
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
@@ -155,9 +156,9 @@ var Button = React3.forwardRef((props, ref) => {
155
156
  ...restProps
156
157
  } = props;
157
158
  return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_theme_ui5.Button, {
158
- ref,
159
159
  type: "button",
160
160
  ...restProps,
161
+ ref,
161
162
  sx: {
162
163
  cursor: "pointer",
163
164
  paddingX: "xl",
@@ -343,7 +344,17 @@ var import_theme_ui18 = require("theme-ui");
343
344
  var import_theme_ui19 = require("theme-ui");
344
345
 
345
346
  // src/components/IconButton.tsx
347
+ var React6 = __toESM(require("react"));
346
348
  var import_theme_ui20 = require("theme-ui");
349
+ var import_jsx_runtime8 = require("react/jsx-runtime");
350
+ var IconButton = React6.forwardRef((props, ref) => {
351
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui20.IconButton, {
352
+ type: "button",
353
+ ...props,
354
+ ref
355
+ });
356
+ });
357
+ IconButton.displayName = "IconButton";
347
358
 
348
359
  // src/components/Slider.tsx
349
360
  var import_theme_ui21 = require("theme-ui");
@@ -352,12 +363,12 @@ var import_theme_ui21 = require("theme-ui");
352
363
  var import_theme_ui22 = require("theme-ui");
353
364
 
354
365
  // src/components/InfiniteLinearProgress.tsx
355
- var React6 = __toESM(require("react"));
356
- var import_jsx_runtime8 = require("react/jsx-runtime");
366
+ var React7 = __toESM(require("react"));
367
+ var import_jsx_runtime9 = require("react/jsx-runtime");
357
368
  var MAX_PROGRESS = 100;
358
369
  var InfiniteLinearProgress = () => {
359
- const [progress, setProgress] = React6.useState(0);
360
- React6.useEffect(() => {
370
+ const [progress, setProgress] = React7.useState(0);
371
+ React7.useEffect(() => {
361
372
  const timer = setInterval(() => {
362
373
  setProgress(oldProgress => {
363
374
  if (oldProgress === MAX_PROGRESS) {
@@ -378,7 +389,7 @@ var InfiniteLinearProgress = () => {
378
389
  clearInterval(timer);
379
390
  };
380
391
  }, []);
381
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui15.Progress, {
392
+ return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui15.Progress, {
382
393
  max: MAX_PROGRESS,
383
394
  value: progress,
384
395
  role: "progressbar"
@@ -392,19 +403,46 @@ var import_theme_ui23 = require("theme-ui");
392
403
  var import_theme_ui24 = require("theme-ui");
393
404
 
394
405
  // src/components/HelpText.tsx
395
- var import_jsx_runtime9 = require("react/jsx-runtime");
406
+ var import_jsx_runtime10 = require("react/jsx-runtime");
396
407
  var HelpText = ({
397
408
  disabled,
398
409
  negative,
399
410
  ...props
400
411
  }) => {
401
412
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
402
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui16.Text, {
413
+ return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui16.Text, {
403
414
  variant,
404
415
  "aria-disabled": disabled ? "true" : void 0,
405
416
  ...props
406
417
  });
407
418
  };
419
+
420
+ // src/components/CloseButton.tsx
421
+ 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(({
425
+ label,
426
+ sx,
427
+ ...props
428
+ }, ref) => {
429
+ return /* @__PURE__ */(0, import_jsx_runtime11.jsxs)(import_theme_ui25.Button, {
430
+ variant: "buttons.closeButton",
431
+ type: "button",
432
+ "aria-label": label,
433
+ sx: {
434
+ gap: "sm",
435
+ padding: 0,
436
+ ...sx
437
+ },
438
+ ...props,
439
+ ref,
440
+ children: [label, /* @__PURE__ */(0, import_jsx_runtime11.jsx)(Icon, {
441
+ icon: "close"
442
+ })]
443
+ });
444
+ });
445
+ CloseButton.displayName = "CloseButton";
408
446
  // Annotate the CommonJS export names for ESM import in node:
409
447
  0 && (module.exports = {
410
448
  Badge,
@@ -413,6 +451,7 @@ var HelpText = ({
413
451
  Button,
414
452
  Card,
415
453
  Checkbox,
454
+ CloseButton,
416
455
  Container,
417
456
  Divider,
418
457
  Flex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.15",
3
+ "version": "1.31.17",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -23,9 +23,9 @@
23
23
  "dependencies": {
24
24
  "@emotion/react": "^11.10.6",
25
25
  "@iconify-icon/react": "^1.0.7",
26
- "@theme-ui/match-media": "^0.15.5",
27
- "@ttoss/theme": "^1.4.13",
28
- "theme-ui": "^0.15.5"
26
+ "@theme-ui/match-media": "^0.15.7",
27
+ "@ttoss/theme": "^1.4.14",
28
+ "theme-ui": "^0.15.7"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": ">=16.8.0"
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "93e161a8af481b0a74c48331c5d193566f3878dc"
49
+ "gitHead": "f7ce64308917a032fdd64066b00d26f12702ef83"
50
50
  }
@@ -16,9 +16,9 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
16
16
 
17
17
  return (
18
18
  <ButtonUi
19
- ref={ref}
20
19
  type="button"
21
20
  {...restProps}
21
+ ref={ref}
22
22
  sx={{
23
23
  cursor: 'pointer',
24
24
  paddingX: 'xl',
@@ -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,12 @@
1
- export { IconButton, type IconButtonProps } from 'theme-ui';
1
+ import * as React from 'react';
2
+ import { type IconButtonProps, IconButton as IconButtonUi } from 'theme-ui';
3
+
4
+ export type { IconButtonProps };
5
+
6
+ export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
7
+ (props, ref) => {
8
+ return <IconButtonUi type="button" {...props} ref={ref} />;
9
+ }
10
+ );
11
+
12
+ IconButton.displayName = 'IconButton';
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';