@ttoss/ui 5.1.5 → 5.2.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
@@ -126,24 +126,76 @@ var Badge = ({
126
126
  import { Box } from "theme-ui";
127
127
 
128
128
  // src/components/Card.tsx
129
- import { Card as CardUi } from "theme-ui";
129
+ import { Box as Box2, Card as CardUi } from "theme-ui";
130
130
  import { jsx as jsx4 } from "react/jsx-runtime";
131
131
  var Card = props => {
132
132
  return /* @__PURE__ */jsx4(CardUi, {
133
133
  ...props,
134
134
  sx: {
135
135
  backgroundColor: "display.background.secondary.default",
136
- borderRadius: "lg",
137
136
  border: "md",
138
- padding: [4, 5],
137
+ borderColor: "display.border.muted.default",
138
+ borderRadius: "lg",
139
139
  display: "flex",
140
140
  flexDirection: "column",
141
141
  alignItems: "center",
142
142
  width: "fit-content",
143
+ boxShadow: "2px 4px 8px #E5E7EB",
143
144
  ...props.sx
144
145
  }
145
146
  });
146
147
  };
148
+ var CardTitle = ({
149
+ children,
150
+ ...props
151
+ }) => {
152
+ return /* @__PURE__ */jsx4(Box2, {
153
+ ...props,
154
+ sx: {
155
+ paddingY: "4",
156
+ paddingX: "8",
157
+ width: "full",
158
+ borderBottom: "md",
159
+ borderBottomColor: "display.border.muted.default",
160
+ ...props.sx
161
+ },
162
+ children
163
+ });
164
+ };
165
+ var CardBody = ({
166
+ children,
167
+ ...props
168
+ }) => {
169
+ return /* @__PURE__ */jsx4(Box2, {
170
+ ...props,
171
+ sx: {
172
+ paddingY: "4",
173
+ paddingX: "8",
174
+ width: "full",
175
+ backgroundColor: "display.background.muted.default",
176
+ ...props.sx
177
+ },
178
+ children
179
+ });
180
+ };
181
+ var CardFooter = ({
182
+ children,
183
+ ...props
184
+ }) => {
185
+ return /* @__PURE__ */jsx4(Box2, {
186
+ ...props,
187
+ sx: {
188
+ paddingY: "2",
189
+ paddingX: "8",
190
+ width: "full",
191
+ ...props.sx
192
+ },
193
+ children
194
+ });
195
+ };
196
+ Card.Title = CardTitle;
197
+ Card.Body = CardBody;
198
+ Card.Footer = CardFooter;
147
199
 
148
200
  // src/components/Checkbox.tsx
149
201
  import * as React2 from "react";
@@ -178,51 +230,51 @@ Checkbox.displayName = "Checkbox";
178
230
 
179
231
  // src/components/CloseButton.tsx
180
232
  import { Icon as Icon3 } from "@ttoss/react-icons";
181
- import * as React3 from "react";
182
233
  import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
183
- var CloseButton = React3.forwardRef(({
184
- label,
185
- sx,
186
- onlyText,
187
- ...props
188
- }, ref) => {
189
- if (onlyText && !label) {
190
- return null;
191
- }
234
+ var CloseButton = props => {
192
235
  return /* @__PURE__ */jsxs3(Button, {
193
- variant: "buttons.closeButton",
194
236
  type: "button",
195
- "aria-label": label,
196
237
  sx: {
197
238
  fontFamily: "body",
198
- fontSize: "xs",
199
- display: "inline-flex",
239
+ display: "flex",
200
240
  alignItems: "center",
201
241
  cursor: "pointer",
202
242
  lineHeight: "normal",
203
- gap: "2",
204
243
  padding: "2",
205
- width: "fit-content",
206
- transition: "all 0.2s",
207
- "& > iconify-icon": {
208
- fontSize: "md"
244
+ backgroundColor: "action.background.primary.active",
245
+ color: "action.text.primary.default",
246
+ border: "sm",
247
+ borderColor: "action.border.primary.default",
248
+ borderRadius: "sm",
249
+ gap: 2,
250
+ ":disabled": {
251
+ border: "sm",
252
+ backgroundColor: "action.background.muted.default",
253
+ borderColor: "action.border.muted.default",
254
+ color: "action.text.muted.default",
255
+ cursor: "not-allowed"
209
256
  },
210
- ...sx
257
+ ":is(:focus-within, :hover):not(:disabled)": {
258
+ color: "action.text.secondary.active",
259
+ backgroundColor: "action.background.secondary.active",
260
+ borderColor: "action.border.secondary.active"
261
+ },
262
+ ...props.sx
211
263
  },
212
264
  ...props,
213
- ref,
214
- children: [label, !onlyText && /* @__PURE__ */jsx6(Icon3, {
265
+ children: [props.label && /* @__PURE__ */jsx6("span", {
266
+ children: props.label
267
+ }), /* @__PURE__ */jsx6(Icon3, {
215
268
  icon: "close"
216
269
  })]
217
270
  });
218
- });
219
- CloseButton.displayName = "CloseButton";
271
+ };
220
272
 
221
273
  // src/components/Container.tsx
222
- import * as React4 from "react";
274
+ import * as React3 from "react";
223
275
  import { Container as ContainerUi } from "theme-ui";
224
276
  import { jsx as jsx7 } from "react/jsx-runtime";
225
- var Container = React4.forwardRef((props, ref) => {
277
+ var Container = React3.forwardRef((props, ref) => {
226
278
  return /* @__PURE__ */jsx7(ContainerUi, {
227
279
  ref,
228
280
  ...props
@@ -265,10 +317,10 @@ var HelpText = ({
265
317
  };
266
318
 
267
319
  // src/components/IconButton.tsx
268
- import * as React5 from "react";
320
+ import * as React4 from "react";
269
321
  import { IconButton as IconButtonUi } from "theme-ui";
270
322
  import { jsx as jsx9 } from "react/jsx-runtime";
271
- var IconButton = React5.forwardRef((props, ref) => {
323
+ var IconButton = React4.forwardRef((props, ref) => {
272
324
  return /* @__PURE__ */jsx9(IconButtonUi, {
273
325
  type: "button",
274
326
  ...props,
@@ -281,7 +333,7 @@ IconButton.displayName = "IconButton";
281
333
  import { Image } from "theme-ui";
282
334
 
283
335
  // src/components/InfiniteLinearProgress.tsx
284
- import * as React6 from "react";
336
+ import * as React5 from "react";
285
337
 
286
338
  // src/components/LinearProgress.tsx
287
339
  import { Progress } from "theme-ui";
@@ -290,8 +342,8 @@ import { Progress } from "theme-ui";
290
342
  import { jsx as jsx10 } from "react/jsx-runtime";
291
343
  var MAX_PROGRESS = 100;
292
344
  var InfiniteLinearProgress = () => {
293
- const [progress, setProgress] = React6.useState(0);
294
- React6.useEffect(() => {
345
+ const [progress, setProgress] = React5.useState(0);
346
+ React5.useEffect(() => {
295
347
  const timer = setInterval(() => {
296
348
  setProgress(oldProgress => {
297
349
  if (oldProgress === MAX_PROGRESS) {
@@ -321,10 +373,10 @@ var InfiniteLinearProgress = () => {
321
373
 
322
374
  // src/components/Input.tsx
323
375
  import { Icon as Icon4 } from "@ttoss/react-icons";
324
- import * as React7 from "react";
376
+ import * as React6 from "react";
325
377
  import { Input as InputUI } from "theme-ui";
326
378
  import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
327
- var Input = React7.forwardRef(({
379
+ var Input = React6.forwardRef(({
328
380
  leadingIcon,
329
381
  trailingIcon: trailingIconProp,
330
382
  onLeadingIconClick,
@@ -388,10 +440,10 @@ Input.displayName = "Input";
388
440
 
389
441
  // src/components/InputNumber.tsx
390
442
  import { Icon as Icon5 } from "@ttoss/react-icons";
391
- import * as React8 from "react";
443
+ import * as React7 from "react";
392
444
  import { Input as Input2 } from "theme-ui";
393
445
  import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
394
- var InputNumber = React8.forwardRef(({
446
+ var InputNumber = React7.forwardRef(({
395
447
  sx,
396
448
  value,
397
449
  infoIcon,
@@ -399,7 +451,7 @@ var InputNumber = React8.forwardRef(({
399
451
  onClickInfoIcon,
400
452
  ...inputProps
401
453
  }, ref) => {
402
- const sxProps = React8.useMemo(() => {
454
+ const sxProps = React7.useMemo(() => {
403
455
  const size = String(typeof value === "undefined" ? 0 : value).length;
404
456
  if (inputProps["aria-invalid"] === "true") {
405
457
  return {
@@ -513,16 +565,16 @@ var InputNumber = React8.forwardRef(({
513
565
  InputNumber.displayName = "InputNumber";
514
566
 
515
567
  // src/components/InputPassword/InputPassword.tsx
516
- import * as React10 from "react";
568
+ import * as React9 from "react";
517
569
 
518
570
  // src/components/InputPassword/useHidePassInput.ts
519
- import * as React9 from "react";
571
+ import * as React8 from "react";
520
572
  var useHidePassInput = (defaultValue = true) => {
521
- const [hidePass, setHidePass] = React9.useState(Boolean(defaultValue));
573
+ const [hidePass, setHidePass] = React8.useState(Boolean(defaultValue));
522
574
  const {
523
575
  icon,
524
576
  inputType
525
- } = React9.useMemo(() => {
577
+ } = React8.useMemo(() => {
526
578
  return {
527
579
  icon: hidePass ? "view-off" : "view-on",
528
580
  inputType: hidePass ? "password" : "text"
@@ -542,7 +594,7 @@ var useHidePassInput = (defaultValue = true) => {
542
594
 
543
595
  // src/components/InputPassword/InputPassword.tsx
544
596
  import { jsx as jsx13 } from "react/jsx-runtime";
545
- var InputPassword = React10.forwardRef(({
597
+ var InputPassword = React9.forwardRef(({
546
598
  showPasswordByDefault,
547
599
  ...inputPasswordProps
548
600
  }, ref) => {
@@ -597,10 +649,10 @@ var Label = ({
597
649
  };
598
650
 
599
651
  // src/components/Link.tsx
600
- import * as React11 from "react";
652
+ import * as React10 from "react";
601
653
  import { Link as LinkUi } from "theme-ui";
602
654
  import { jsx as jsx15 } from "react/jsx-runtime";
603
- var Link = React11.forwardRef(({
655
+ var Link = React10.forwardRef(({
604
656
  quiet,
605
657
  className,
606
658
  ...props
@@ -621,7 +673,7 @@ import { Radio } from "theme-ui";
621
673
 
622
674
  // src/components/Select.tsx
623
675
  import { Icon as Icon7 } from "@ttoss/react-icons";
624
- import * as React12 from "react";
676
+ import * as React11 from "react";
625
677
  import ReactSelect, { components } from "react-select";
626
678
  import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
627
679
  var Control = props => {
@@ -779,7 +831,7 @@ var ValueContainer = ({
779
831
  })]
780
832
  });
781
833
  };
782
- var Select = React12.forwardRef(({
834
+ var Select = React11.forwardRef(({
783
835
  ...props
784
836
  }, ref) => {
785
837
  const value = props.options?.find(option => {
@@ -866,10 +918,10 @@ var Switch = props => {
866
918
 
867
919
  // src/components/Textarea.tsx
868
920
  import { Icon as Icon8 } from "@ttoss/react-icons";
869
- import * as React13 from "react";
921
+ import * as React12 from "react";
870
922
  import { Textarea as TextareaUI } from "theme-ui";
871
923
  import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
872
- var Textarea = React13.forwardRef(({
924
+ var Textarea = React12.forwardRef(({
873
925
  trailingIcon,
874
926
  className,
875
927
  sx,
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { IconType } from '@ttoss/react-icons';
3
3
  import * as React from 'react';
4
4
  import * as theme_ui from 'theme-ui';
5
- import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CardProps, CheckboxProps as CheckboxProps$1, TextProps, IconButtonProps, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, SxProp, FlexProps, SwitchProps, TextareaProps as TextareaProps$1, Theme } from 'theme-ui';
5
+ import { ButtonProps as ButtonProps$1, BadgeProps as BadgeProps$1, CardProps, BoxProps, CheckboxProps as CheckboxProps$1, TextProps, IconButtonProps, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, SxProp, FlexProps, SwitchProps, TextareaProps as TextareaProps$1, Theme } from 'theme-ui';
6
6
  export { BaseStyles, Box, BoxProps, CardProps, ContainerProps, Divider, DividerProps, Flex, FlexProps, Global, Grid, GridProps, Heading, HeadingProps, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Paragraph, ParagraphProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, SwitchProps, SxProp, Text, TextProps, Theme, ThemeUIStyleObject } from 'theme-ui';
7
7
  import { Props } from 'react-select';
8
8
  export { Keyframes, keyframes } from '@emotion/react';
@@ -28,7 +28,12 @@ type BadgeProps = BadgeProps$1 & {
28
28
  };
29
29
  declare const Badge: ({ icon, children, sx, chip, onDelete, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
30
30
 
31
- declare const Card: (props: CardProps) => react_jsx_runtime.JSX.Element;
31
+ declare const Card: {
32
+ (props: CardProps): react_jsx_runtime.JSX.Element;
33
+ Title: ({ children, ...props }: React.PropsWithChildren<BoxProps>) => react_jsx_runtime.JSX.Element;
34
+ Body: ({ children, ...props }: React.PropsWithChildren<BoxProps>) => react_jsx_runtime.JSX.Element;
35
+ Footer: ({ children, ...props }: React.PropsWithChildren<BoxProps>) => react_jsx_runtime.JSX.Element;
36
+ };
32
37
 
33
38
  interface CheckboxProps extends CheckboxProps$1 {
34
39
  indeterminate?: boolean;
@@ -37,9 +42,8 @@ declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref
37
42
 
38
43
  type CloseButtonProps = ButtonProps & {
39
44
  label?: string;
40
- onlyText?: boolean;
41
45
  };
42
- declare const CloseButton: React.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
46
+ declare const CloseButton: (props: CloseButtonProps) => react_jsx_runtime.JSX.Element;
43
47
 
44
48
  declare const Container: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLDivElement>>;
45
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "5.1.5",
3
+ "version": "5.2.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -27,7 +27,7 @@
27
27
  "@theme-ui/match-media": "^0.17.1",
28
28
  "react-select": "^5.9.0",
29
29
  "theme-ui": "^0.17.1",
30
- "@ttoss/theme": "^2.1.1"
30
+ "@ttoss/theme": "^2.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@emotion/react": "^11",
@@ -43,8 +43,8 @@
43
43
  "react": "^19.0.0",
44
44
  "tsup": "^8.3.5",
45
45
  "@ttoss/config": "^1.35.2",
46
- "@ttoss/react-icons": "^0.4.9",
47
- "@ttoss/test-utils": "^2.1.22"
46
+ "@ttoss/test-utils": "^2.1.22",
47
+ "@ttoss/react-icons": "^0.4.9"
48
48
  },
49
49
  "keywords": [
50
50
  "React",