@ttoss/ui 4.1.0 → 4.1.1

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
@@ -36,11 +36,18 @@ var useTheme = useThemeUI;
36
36
  // src/components/Badge.tsx
37
37
  import { Badge as BadgeUi } from "theme-ui";
38
38
  import { Icon } from "@ttoss/react-icons";
39
+
40
+ // src/components/Text.tsx
41
+ import { Text } from "theme-ui";
42
+
43
+ // src/components/Badge.tsx
39
44
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
40
45
  var Badge = ({
41
46
  icon,
42
47
  children,
43
48
  sx,
49
+ chip,
50
+ onDelete,
44
51
  ...props
45
52
  }) => {
46
53
  return /* @__PURE__ */jsxs2(BadgeUi, {
@@ -61,7 +68,19 @@ var Badge = ({
61
68
  children: [icon && /* @__PURE__ */jsx2(Icon, {
62
69
  inline: true,
63
70
  icon
64
- }), children]
71
+ }), children, chip && /* @__PURE__ */jsx2(Text, {
72
+ sx: {
73
+ cursor: "pointer",
74
+ lineHeight: 0,
75
+ color: "currentcolor",
76
+ alignSelf: "center"
77
+ },
78
+ children: /* @__PURE__ */jsx2(Icon, {
79
+ onClick: onDelete,
80
+ inline: true,
81
+ icon: "close"
82
+ })
83
+ })]
65
84
  });
66
85
  };
67
86
 
@@ -250,9 +269,6 @@ Link.displayName = "Link";
250
269
  // src/components/LinearProgress.tsx
251
270
  import { Progress } from "theme-ui";
252
271
 
253
- // src/components/Text.tsx
254
- import { Text } from "theme-ui";
255
-
256
272
  // src/components/Select.tsx
257
273
  import * as React4 from "react";
258
274
  import { Icon as Icon5 } from "@ttoss/react-icons";
package/dist/index.d.mts CHANGED
@@ -22,8 +22,10 @@ declare const useTheme: () => theme_ui.ThemeUIContextValue;
22
22
 
23
23
  type BadgeProps = BadgeProps$1 & {
24
24
  icon?: IconType;
25
+ chip?: boolean;
26
+ onDelete?: () => void;
25
27
  };
26
- declare const Badge: ({ icon, children, sx, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
28
+ declare const Badge: ({ icon, children, sx, chip, onDelete, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
27
29
 
28
30
  type ButtonProps = ButtonProps$1 & {
29
31
  leftIcon?: IconType;
package/dist/index.d.ts CHANGED
@@ -22,8 +22,10 @@ declare const useTheme: () => theme_ui.ThemeUIContextValue;
22
22
 
23
23
  type BadgeProps = BadgeProps$1 & {
24
24
  icon?: IconType;
25
+ chip?: boolean;
26
+ onDelete?: () => void;
25
27
  };
26
- declare const Badge: ({ icon, children, sx, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
28
+ declare const Badge: ({ icon, children, sx, chip, onDelete, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
27
29
 
28
30
  type ButtonProps = ButtonProps$1 & {
29
31
  leftIcon?: IconType;
package/dist/index.js CHANGED
@@ -41,26 +41,26 @@ __export(src_exports, {
41
41
  ActionButton: () => ActionButton,
42
42
  Badge: () => Badge,
43
43
  BaseStyles: () => import_theme_ui26.BaseStyles,
44
- Box: () => import_theme_ui4.Box,
44
+ Box: () => import_theme_ui5.Box,
45
45
  Button: () => Button,
46
- Card: () => import_theme_ui6.Card,
46
+ Card: () => import_theme_ui7.Card,
47
47
  Checkbox: () => import_theme_ui21.Checkbox,
48
48
  CloseButton: () => CloseButton,
49
49
  Container: () => Container,
50
- Divider: () => import_theme_ui7.Divider,
51
- Flex: () => import_theme_ui8.Flex,
50
+ Divider: () => import_theme_ui8.Divider,
51
+ Flex: () => import_theme_ui9.Flex,
52
52
  Global: () => import_theme_ui26.Global,
53
- Grid: () => import_theme_ui9.Grid,
54
- Heading: () => import_theme_ui10.Heading,
53
+ Grid: () => import_theme_ui10.Grid,
54
+ Heading: () => import_theme_ui11.Heading,
55
55
  HelpText: () => HelpText,
56
56
  IconButton: () => IconButton,
57
- Image: () => import_theme_ui11.Image,
57
+ Image: () => import_theme_ui12.Image,
58
58
  InfiniteLinearProgress: () => InfiniteLinearProgress,
59
59
  Input: () => Input,
60
60
  InputNumber: () => InputNumber,
61
61
  InputPassword: () => InputPassword,
62
62
  Label: () => Label,
63
- LinearProgress: () => import_theme_ui15.Progress,
63
+ LinearProgress: () => import_theme_ui16.Progress,
64
64
  Link: () => Link,
65
65
  Paragraph: () => import_theme_ui25.Paragraph,
66
66
  Radio: () => import_theme_ui18.Radio,
@@ -68,7 +68,7 @@ __export(src_exports, {
68
68
  Slider: () => import_theme_ui20.Slider,
69
69
  Spinner: () => import_theme_ui17.Spinner,
70
70
  Stack: () => Stack,
71
- Text: () => import_theme_ui16.Text,
71
+ Text: () => import_theme_ui3.Text,
72
72
  Textarea: () => Textarea,
73
73
  ThemeProvider: () => ThemeProvider,
74
74
  keyframes: () => import_react2.keyframes,
@@ -110,16 +110,23 @@ var import_theme_ui2 = require("theme-ui");
110
110
  var useTheme = import_theme_ui2.useThemeUI;
111
111
 
112
112
  // src/components/Badge.tsx
113
- var import_theme_ui3 = require("theme-ui");
113
+ var import_theme_ui4 = require("theme-ui");
114
114
  var import_react_icons = require("@ttoss/react-icons");
115
+
116
+ // src/components/Text.tsx
117
+ var import_theme_ui3 = require("theme-ui");
118
+
119
+ // src/components/Badge.tsx
115
120
  var import_jsx_runtime2 = require("react/jsx-runtime");
116
121
  var Badge = ({
117
122
  icon,
118
123
  children,
119
124
  sx,
125
+ chip,
126
+ onDelete,
120
127
  ...props
121
128
  }) => {
122
- return /* @__PURE__ */(0, import_jsx_runtime2.jsxs)(import_theme_ui3.Badge, {
129
+ return /* @__PURE__ */(0, import_jsx_runtime2.jsxs)(import_theme_ui4.Badge, {
123
130
  sx: {
124
131
  display: "flex",
125
132
  alignItems: "center",
@@ -137,16 +144,28 @@ var Badge = ({
137
144
  children: [icon && /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_react_icons.Icon, {
138
145
  inline: true,
139
146
  icon
140
- }), children]
147
+ }), children, chip && /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_theme_ui3.Text, {
148
+ sx: {
149
+ cursor: "pointer",
150
+ lineHeight: 0,
151
+ color: "currentcolor",
152
+ alignSelf: "center"
153
+ },
154
+ children: /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_react_icons.Icon, {
155
+ onClick: onDelete,
156
+ inline: true,
157
+ icon: "close"
158
+ })
159
+ })]
141
160
  });
142
161
  };
143
162
 
144
163
  // src/components/Box.tsx
145
- var import_theme_ui4 = require("theme-ui");
164
+ var import_theme_ui5 = require("theme-ui");
146
165
 
147
166
  // src/components/Button.tsx
148
167
  var React = __toESM(require("react"));
149
- var import_theme_ui5 = require("theme-ui");
168
+ var import_theme_ui6 = require("theme-ui");
150
169
  var import_react_icons2 = require("@ttoss/react-icons");
151
170
  var import_jsx_runtime3 = require("react/jsx-runtime");
152
171
  var Button = React.forwardRef((props, ref) => {
@@ -157,7 +176,7 @@ var Button = React.forwardRef((props, ref) => {
157
176
  loading,
158
177
  ...restProps
159
178
  } = props;
160
- return /* @__PURE__ */(0, import_jsx_runtime3.jsxs)(import_theme_ui5.Button, {
179
+ return /* @__PURE__ */(0, import_jsx_runtime3.jsxs)(import_theme_ui6.Button, {
161
180
  type: "button",
162
181
  ...restProps,
163
182
  ref,
@@ -186,27 +205,27 @@ var Button = React.forwardRef((props, ref) => {
186
205
  Button.displayName = "Button";
187
206
 
188
207
  // src/components/Card.tsx
189
- var import_theme_ui6 = require("theme-ui");
208
+ var import_theme_ui7 = require("theme-ui");
190
209
 
191
210
  // src/components/Divider.tsx
192
- var import_theme_ui7 = require("theme-ui");
211
+ var import_theme_ui8 = require("theme-ui");
193
212
 
194
213
  // src/components/Flex.tsx
195
- var import_theme_ui8 = require("theme-ui");
214
+ var import_theme_ui9 = require("theme-ui");
196
215
 
197
216
  // src/components/Grid.tsx
198
- var import_theme_ui9 = require("theme-ui");
217
+ var import_theme_ui10 = require("theme-ui");
199
218
 
200
219
  // src/components/Heading.tsx
201
- var import_theme_ui10 = require("theme-ui");
220
+ var import_theme_ui11 = require("theme-ui");
202
221
 
203
222
  // src/components/Image.tsx
204
- var import_theme_ui11 = require("theme-ui");
223
+ var import_theme_ui12 = require("theme-ui");
205
224
 
206
225
  // src/components/Input.tsx
207
226
  var React2 = __toESM(require("react"));
208
227
  var import_react_icons3 = require("@ttoss/react-icons");
209
- var import_theme_ui12 = require("theme-ui");
228
+ var import_theme_ui13 = require("theme-ui");
210
229
  var import_jsx_runtime4 = require("react/jsx-runtime");
211
230
  var Input = React2.forwardRef(({
212
231
  leadingIcon,
@@ -218,7 +237,7 @@ var Input = React2.forwardRef(({
218
237
  ...inputProps
219
238
  }, ref) => {
220
239
  const trailingIcon = inputProps["aria-invalid"] ? "warning-alt" : trailingIconProp;
221
- return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_theme_ui8.Flex, {
240
+ return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_theme_ui9.Flex, {
222
241
  className,
223
242
  sx: {
224
243
  ...sx,
@@ -226,7 +245,7 @@ var Input = React2.forwardRef(({
226
245
  padding: 0,
227
246
  border: "none"
228
247
  },
229
- children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui16.Text, {
248
+ children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui3.Text, {
230
249
  sx: {
231
250
  position: "absolute",
232
251
  alignSelf: "center",
@@ -239,7 +258,7 @@ var Input = React2.forwardRef(({
239
258
  inline: true,
240
259
  icon: leadingIcon
241
260
  })
242
- }), /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui12.Input, {
261
+ }), /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui13.Input, {
243
262
  ref,
244
263
  sx: {
245
264
  fontFamily: "body",
@@ -252,7 +271,7 @@ var Input = React2.forwardRef(({
252
271
  },
253
272
  className,
254
273
  ...inputProps
255
- }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui16.Text, {
274
+ }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui3.Text, {
256
275
  sx: {
257
276
  position: "absolute",
258
277
  right: "1rem",
@@ -272,7 +291,7 @@ Input.displayName = "Input";
272
291
 
273
292
  // src/components/Label.tsx
274
293
  var import_react_icons4 = require("@ttoss/react-icons");
275
- var import_theme_ui13 = require("theme-ui");
294
+ var import_theme_ui14 = require("theme-ui");
276
295
  var import_jsx_runtime5 = require("react/jsx-runtime");
277
296
  var TOOLTIP_LABEL = "tooltip";
278
297
  var Label = ({
@@ -282,7 +301,7 @@ var Label = ({
282
301
  sx,
283
302
  ...props
284
303
  }) => {
285
- return /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(import_theme_ui13.Label, {
304
+ return /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(import_theme_ui14.Label, {
286
305
  sx: {
287
306
  fontFamily: "caption",
288
307
  alignItems: "center",
@@ -291,7 +310,7 @@ var Label = ({
291
310
  ...sx
292
311
  },
293
312
  ...props,
294
- children: [children, tooltip && /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui16.Text, {
313
+ children: [children, tooltip && /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui3.Text, {
295
314
  sx: {
296
315
  color: "currentcolor",
297
316
  cursor: onTooltipClick ? "pointer" : void 0
@@ -308,14 +327,14 @@ var Label = ({
308
327
 
309
328
  // src/components/Link.tsx
310
329
  var React3 = __toESM(require("react"));
311
- var import_theme_ui14 = require("theme-ui");
330
+ var import_theme_ui15 = require("theme-ui");
312
331
  var import_jsx_runtime6 = require("react/jsx-runtime");
313
332
  var Link = React3.forwardRef(({
314
333
  quiet,
315
334
  className,
316
335
  ...props
317
336
  }, ref) => {
318
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui14.Link, {
337
+ return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui15.Link, {
319
338
  className: `${quiet ? "quiet" : ""} ${className ?? ""}`,
320
339
  ...props,
321
340
  ref
@@ -324,9 +343,6 @@ var Link = React3.forwardRef(({
324
343
  Link.displayName = "Link";
325
344
 
326
345
  // src/components/LinearProgress.tsx
327
- var import_theme_ui15 = require("theme-ui");
328
-
329
- // src/components/Text.tsx
330
346
  var import_theme_ui16 = require("theme-ui");
331
347
 
332
348
  // src/components/Select.tsx
@@ -352,7 +368,7 @@ var Control = props => {
352
368
  }
353
369
  return "surface";
354
370
  })();
355
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui4.Box, {
371
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui5.Box, {
356
372
  sx: {
357
373
  ".react-select__control": {
358
374
  border,
@@ -375,7 +391,7 @@ var DropdownIndicator = props => {
375
391
  }
376
392
  return "text";
377
393
  })();
378
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
394
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
379
395
  sx: {
380
396
  fontSize: "base",
381
397
  color,
@@ -393,7 +409,7 @@ var IndicatorsContainer = ({
393
409
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
394
410
  ...props
395
411
  }) => {
396
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui4.Box, {
412
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui5.Box, {
397
413
  sx: {
398
414
  marginLeft: "lg",
399
415
  border: "none"
@@ -404,7 +420,7 @@ var IndicatorsContainer = ({
404
420
  var Placeholder = ({
405
421
  children
406
422
  }) => {
407
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
423
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
408
424
  sx: {
409
425
  color: "onMuted",
410
426
  alignSelf: "center"
@@ -420,7 +436,7 @@ var SelectContainer = ({
420
436
  sx,
421
437
  css: css2
422
438
  } = props.selectProps;
423
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui4.Box, {
439
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui5.Box, {
424
440
  sx,
425
441
  css: css2,
426
442
  children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_select.components.SelectContainer, {
@@ -452,12 +468,12 @@ var ValueContainer = ({
452
468
  }
453
469
  return leadingIcon || "search";
454
470
  })();
455
- return /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_theme_ui8.Flex, {
471
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_theme_ui9.Flex, {
456
472
  sx: {
457
473
  gap: "lg",
458
474
  flex: 1
459
475
  },
460
- children: [finalLeadingIcon && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
476
+ children: [finalLeadingIcon && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
461
477
  sx: {
462
478
  alignSelf: "center",
463
479
  pointerEvents: "none",
@@ -467,13 +483,13 @@ var ValueContainer = ({
467
483
  children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_icons5.Icon, {
468
484
  icon: finalLeadingIcon
469
485
  })
470
- }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui8.Flex, {
486
+ }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui9.Flex, {
471
487
  sx: {
472
488
  flex: 1,
473
489
  alignItems: "center"
474
490
  },
475
491
  children
476
- }), (trailingIcon || hasError) && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
492
+ }), (trailingIcon || hasError) && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
477
493
  className: hasError ? "error-icon" : "",
478
494
  sx: {
479
495
  alignSelf: "center",
@@ -578,7 +594,7 @@ var InfiniteLinearProgress = () => {
578
594
  clearInterval(timer);
579
595
  };
580
596
  }, []);
581
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui15.Progress, {
597
+ return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui16.Progress, {
582
598
  max: MAX_PROGRESS,
583
599
  value: progress,
584
600
  role: "progressbar"
@@ -596,7 +612,7 @@ var Textarea = React7.forwardRef(({
596
612
  sx,
597
613
  ...textareaProps
598
614
  }, ref) => {
599
- return /* @__PURE__ */(0, import_jsx_runtime10.jsxs)(import_theme_ui8.Flex, {
615
+ return /* @__PURE__ */(0, import_jsx_runtime10.jsxs)(import_theme_ui9.Flex, {
600
616
  className,
601
617
  sx: {
602
618
  ...sx,
@@ -616,7 +632,7 @@ var Textarea = React7.forwardRef(({
616
632
  },
617
633
  className,
618
634
  ...textareaProps
619
- }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui16.Text, {
635
+ }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui3.Text, {
620
636
  sx: {
621
637
  position: "absolute",
622
638
  right: "1.25rem",
@@ -652,7 +668,7 @@ var HelpText = ({
652
668
  ...props
653
669
  }) => {
654
670
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
655
- return /* @__PURE__ */(0, import_jsx_runtime12.jsx)(import_theme_ui16.Text, {
671
+ return /* @__PURE__ */(0, import_jsx_runtime12.jsx)(import_theme_ui3.Text, {
656
672
  variant,
657
673
  sx: {
658
674
  fontSize: "sm",
@@ -772,7 +788,7 @@ var InputNumber = React10.forwardRef(({
772
788
  }
773
789
  onChange(value + 1);
774
790
  };
775
- return /* @__PURE__ */(0, import_jsx_runtime14.jsxs)(import_theme_ui8.Flex, {
791
+ return /* @__PURE__ */(0, import_jsx_runtime14.jsxs)(import_theme_ui9.Flex, {
776
792
  sx: {
777
793
  width: "fit-content",
778
794
  ...sx,
@@ -792,7 +808,7 @@ var InputNumber = React10.forwardRef(({
792
808
  },
793
809
  value,
794
810
  ...inputProps
795
- }), /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_theme_ui16.Text, {
811
+ }), /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_theme_ui3.Text, {
796
812
  sx: {
797
813
  position: "absolute",
798
814
  alignSelf: "center",
@@ -804,7 +820,7 @@ var InputNumber = React10.forwardRef(({
804
820
  children: /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_react_icons8.Icon, {
805
821
  icon: "picker-down"
806
822
  })
807
- }), infoIcon && /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_theme_ui16.Text, {
823
+ }), infoIcon && /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_theme_ui3.Text, {
808
824
  sx: {
809
825
  position: "absolute",
810
826
  alignSelf: "center",
@@ -816,7 +832,7 @@ var InputNumber = React10.forwardRef(({
816
832
  children: /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_react_icons8.Icon, {
817
833
  icon: "info"
818
834
  })
819
- }), /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_theme_ui16.Text, {
835
+ }), /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_theme_ui3.Text, {
820
836
  sx: {
821
837
  position: "absolute",
822
838
  alignSelf: "center",
@@ -837,7 +853,7 @@ InputNumber.displayName = "InputNumber";
837
853
  var React11 = __toESM(require("react"));
838
854
  var import_jsx_runtime15 = require("react/jsx-runtime");
839
855
  var Stack = React11.forwardRef((props, ref) => {
840
- return /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_theme_ui8.Flex, {
856
+ return /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_theme_ui9.Flex, {
841
857
  ref,
842
858
  ...props,
843
859
  sx: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -38,9 +38,9 @@
38
38
  "jest": "^29.7.0",
39
39
  "react": "^18.2.0",
40
40
  "tsup": "^8.0.1",
41
+ "@ttoss/test-utils": "^2.1.0",
41
42
  "@ttoss/config": "^1.31.4",
42
- "@ttoss/react-icons": "^0.3.0",
43
- "@ttoss/test-utils": "^2.1.0"
43
+ "@ttoss/react-icons": "^0.3.0"
44
44
  },
45
45
  "keywords": [
46
46
  "React",
@@ -1,11 +1,21 @@
1
1
  import { type BadgeProps as BadgePropsUi, Badge as BadgeUi } from 'theme-ui';
2
2
  import { Icon, IconType } from '@ttoss/react-icons';
3
+ import { Text } from '../components/Text';
3
4
 
4
5
  export type BadgeProps = BadgePropsUi & {
5
6
  icon?: IconType;
7
+ chip?: boolean;
8
+ onDelete?: () => void;
6
9
  };
7
10
 
8
- export const Badge = ({ icon, children, sx, ...props }: BadgeProps) => {
11
+ export const Badge = ({
12
+ icon,
13
+ children,
14
+ sx,
15
+ chip,
16
+ onDelete,
17
+ ...props
18
+ }: BadgeProps) => {
9
19
  return (
10
20
  <BadgeUi
11
21
  sx={{
@@ -24,7 +34,21 @@ export const Badge = ({ icon, children, sx, ...props }: BadgeProps) => {
24
34
  {...props}
25
35
  >
26
36
  {icon && <Icon inline icon={icon} />}
37
+
27
38
  {children}
39
+
40
+ {chip && (
41
+ <Text
42
+ sx={{
43
+ cursor: 'pointer',
44
+ lineHeight: 0,
45
+ color: 'currentcolor',
46
+ alignSelf: 'center',
47
+ }}
48
+ >
49
+ <Icon onClick={onDelete} inline icon="close" />
50
+ </Text>
51
+ )}
28
52
  </BadgeUi>
29
53
  );
30
54
  };