@ttoss/ui 5.1.6 → 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,7 +126,7 @@ 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, {
@@ -145,6 +145,57 @@ var Card = props => {
145
145
  }
146
146
  });
147
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;
148
199
 
149
200
  // src/components/Checkbox.tsx
150
201
  import * as React2 from "react";
@@ -179,51 +230,51 @@ Checkbox.displayName = "Checkbox";
179
230
 
180
231
  // src/components/CloseButton.tsx
181
232
  import { Icon as Icon3 } from "@ttoss/react-icons";
182
- import * as React3 from "react";
183
233
  import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
184
- var CloseButton = React3.forwardRef(({
185
- label,
186
- sx,
187
- onlyText,
188
- ...props
189
- }, ref) => {
190
- if (onlyText && !label) {
191
- return null;
192
- }
234
+ var CloseButton = props => {
193
235
  return /* @__PURE__ */jsxs3(Button, {
194
- variant: "buttons.closeButton",
195
236
  type: "button",
196
- "aria-label": label,
197
237
  sx: {
198
238
  fontFamily: "body",
199
- fontSize: "xs",
200
- display: "inline-flex",
239
+ display: "flex",
201
240
  alignItems: "center",
202
241
  cursor: "pointer",
203
242
  lineHeight: "normal",
204
- gap: "2",
205
243
  padding: "2",
206
- width: "fit-content",
207
- transition: "all 0.2s",
208
- "& > iconify-icon": {
209
- 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"
210
256
  },
211
- ...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
212
263
  },
213
264
  ...props,
214
- ref,
215
- children: [label, !onlyText && /* @__PURE__ */jsx6(Icon3, {
265
+ children: [props.label && /* @__PURE__ */jsx6("span", {
266
+ children: props.label
267
+ }), /* @__PURE__ */jsx6(Icon3, {
216
268
  icon: "close"
217
269
  })]
218
270
  });
219
- });
220
- CloseButton.displayName = "CloseButton";
271
+ };
221
272
 
222
273
  // src/components/Container.tsx
223
- import * as React4 from "react";
274
+ import * as React3 from "react";
224
275
  import { Container as ContainerUi } from "theme-ui";
225
276
  import { jsx as jsx7 } from "react/jsx-runtime";
226
- var Container = React4.forwardRef((props, ref) => {
277
+ var Container = React3.forwardRef((props, ref) => {
227
278
  return /* @__PURE__ */jsx7(ContainerUi, {
228
279
  ref,
229
280
  ...props
@@ -266,10 +317,10 @@ var HelpText = ({
266
317
  };
267
318
 
268
319
  // src/components/IconButton.tsx
269
- import * as React5 from "react";
320
+ import * as React4 from "react";
270
321
  import { IconButton as IconButtonUi } from "theme-ui";
271
322
  import { jsx as jsx9 } from "react/jsx-runtime";
272
- var IconButton = React5.forwardRef((props, ref) => {
323
+ var IconButton = React4.forwardRef((props, ref) => {
273
324
  return /* @__PURE__ */jsx9(IconButtonUi, {
274
325
  type: "button",
275
326
  ...props,
@@ -282,7 +333,7 @@ IconButton.displayName = "IconButton";
282
333
  import { Image } from "theme-ui";
283
334
 
284
335
  // src/components/InfiniteLinearProgress.tsx
285
- import * as React6 from "react";
336
+ import * as React5 from "react";
286
337
 
287
338
  // src/components/LinearProgress.tsx
288
339
  import { Progress } from "theme-ui";
@@ -291,8 +342,8 @@ import { Progress } from "theme-ui";
291
342
  import { jsx as jsx10 } from "react/jsx-runtime";
292
343
  var MAX_PROGRESS = 100;
293
344
  var InfiniteLinearProgress = () => {
294
- const [progress, setProgress] = React6.useState(0);
295
- React6.useEffect(() => {
345
+ const [progress, setProgress] = React5.useState(0);
346
+ React5.useEffect(() => {
296
347
  const timer = setInterval(() => {
297
348
  setProgress(oldProgress => {
298
349
  if (oldProgress === MAX_PROGRESS) {
@@ -322,10 +373,10 @@ var InfiniteLinearProgress = () => {
322
373
 
323
374
  // src/components/Input.tsx
324
375
  import { Icon as Icon4 } from "@ttoss/react-icons";
325
- import * as React7 from "react";
376
+ import * as React6 from "react";
326
377
  import { Input as InputUI } from "theme-ui";
327
378
  import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
328
- var Input = React7.forwardRef(({
379
+ var Input = React6.forwardRef(({
329
380
  leadingIcon,
330
381
  trailingIcon: trailingIconProp,
331
382
  onLeadingIconClick,
@@ -389,10 +440,10 @@ Input.displayName = "Input";
389
440
 
390
441
  // src/components/InputNumber.tsx
391
442
  import { Icon as Icon5 } from "@ttoss/react-icons";
392
- import * as React8 from "react";
443
+ import * as React7 from "react";
393
444
  import { Input as Input2 } from "theme-ui";
394
445
  import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
395
- var InputNumber = React8.forwardRef(({
446
+ var InputNumber = React7.forwardRef(({
396
447
  sx,
397
448
  value,
398
449
  infoIcon,
@@ -400,7 +451,7 @@ var InputNumber = React8.forwardRef(({
400
451
  onClickInfoIcon,
401
452
  ...inputProps
402
453
  }, ref) => {
403
- const sxProps = React8.useMemo(() => {
454
+ const sxProps = React7.useMemo(() => {
404
455
  const size = String(typeof value === "undefined" ? 0 : value).length;
405
456
  if (inputProps["aria-invalid"] === "true") {
406
457
  return {
@@ -514,16 +565,16 @@ var InputNumber = React8.forwardRef(({
514
565
  InputNumber.displayName = "InputNumber";
515
566
 
516
567
  // src/components/InputPassword/InputPassword.tsx
517
- import * as React10 from "react";
568
+ import * as React9 from "react";
518
569
 
519
570
  // src/components/InputPassword/useHidePassInput.ts
520
- import * as React9 from "react";
571
+ import * as React8 from "react";
521
572
  var useHidePassInput = (defaultValue = true) => {
522
- const [hidePass, setHidePass] = React9.useState(Boolean(defaultValue));
573
+ const [hidePass, setHidePass] = React8.useState(Boolean(defaultValue));
523
574
  const {
524
575
  icon,
525
576
  inputType
526
- } = React9.useMemo(() => {
577
+ } = React8.useMemo(() => {
527
578
  return {
528
579
  icon: hidePass ? "view-off" : "view-on",
529
580
  inputType: hidePass ? "password" : "text"
@@ -543,7 +594,7 @@ var useHidePassInput = (defaultValue = true) => {
543
594
 
544
595
  // src/components/InputPassword/InputPassword.tsx
545
596
  import { jsx as jsx13 } from "react/jsx-runtime";
546
- var InputPassword = React10.forwardRef(({
597
+ var InputPassword = React9.forwardRef(({
547
598
  showPasswordByDefault,
548
599
  ...inputPasswordProps
549
600
  }, ref) => {
@@ -598,10 +649,10 @@ var Label = ({
598
649
  };
599
650
 
600
651
  // src/components/Link.tsx
601
- import * as React11 from "react";
652
+ import * as React10 from "react";
602
653
  import { Link as LinkUi } from "theme-ui";
603
654
  import { jsx as jsx15 } from "react/jsx-runtime";
604
- var Link = React11.forwardRef(({
655
+ var Link = React10.forwardRef(({
605
656
  quiet,
606
657
  className,
607
658
  ...props
@@ -622,7 +673,7 @@ import { Radio } from "theme-ui";
622
673
 
623
674
  // src/components/Select.tsx
624
675
  import { Icon as Icon7 } from "@ttoss/react-icons";
625
- import * as React12 from "react";
676
+ import * as React11 from "react";
626
677
  import ReactSelect, { components } from "react-select";
627
678
  import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
628
679
  var Control = props => {
@@ -780,7 +831,7 @@ var ValueContainer = ({
780
831
  })]
781
832
  });
782
833
  };
783
- var Select = React12.forwardRef(({
834
+ var Select = React11.forwardRef(({
784
835
  ...props
785
836
  }, ref) => {
786
837
  const value = props.options?.find(option => {
@@ -867,10 +918,10 @@ var Switch = props => {
867
918
 
868
919
  // src/components/Textarea.tsx
869
920
  import { Icon as Icon8 } from "@ttoss/react-icons";
870
- import * as React13 from "react";
921
+ import * as React12 from "react";
871
922
  import { Textarea as TextareaUI } from "theme-ui";
872
923
  import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
873
- var Textarea = React13.forwardRef(({
924
+ var Textarea = React12.forwardRef(({
874
925
  trailingIcon,
875
926
  className,
876
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.6",
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",