@ttoss/ui 1.34.0 → 1.34.2
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 +5 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -7
- package/package.json +3 -3
- package/src/components/CloseButton.tsx +7 -3
package/dist/esm/index.js
CHANGED
|
@@ -407,21 +407,19 @@ import React10 from "react";
|
|
|
407
407
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
408
408
|
var CloseButton = /*#__PURE__*/React10.forwardRef(({
|
|
409
409
|
label,
|
|
410
|
-
|
|
410
|
+
onlyText,
|
|
411
411
|
...props
|
|
412
412
|
}, ref) => {
|
|
413
|
+
if (onlyText && !label) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
413
416
|
return /* @__PURE__ */jsxs8(Button2, {
|
|
414
417
|
variant: "buttons.closeButton",
|
|
415
418
|
type: "button",
|
|
416
419
|
"aria-label": label,
|
|
417
|
-
sx: {
|
|
418
|
-
gap: "sm",
|
|
419
|
-
padding: 0,
|
|
420
|
-
...sx
|
|
421
|
-
},
|
|
422
420
|
...props,
|
|
423
421
|
ref,
|
|
424
|
-
children: [label, /* @__PURE__ */jsx13(Icon, {
|
|
422
|
+
children: [label, !onlyText && /* @__PURE__ */jsx13(Icon, {
|
|
425
423
|
icon: "close"
|
|
426
424
|
})]
|
|
427
425
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ declare const HelpText: ({ disabled, negative, ...props }: HelpTextProps) => JSX
|
|
|
71
71
|
|
|
72
72
|
type CloseButtonProps = ButtonProps$1 & {
|
|
73
73
|
label?: string;
|
|
74
|
+
onlyText?: boolean;
|
|
74
75
|
};
|
|
75
76
|
declare const CloseButton: React__default.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
|
|
76
77
|
|
package/dist/index.js
CHANGED
|
@@ -481,21 +481,19 @@ var import_react7 = __toESM(require("react"));
|
|
|
481
481
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
482
482
|
var CloseButton = import_react7.default.forwardRef(({
|
|
483
483
|
label,
|
|
484
|
-
|
|
484
|
+
onlyText,
|
|
485
485
|
...props
|
|
486
486
|
}, ref) => {
|
|
487
|
+
if (onlyText && !label) {
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
487
490
|
return /* @__PURE__ */(0, import_jsx_runtime13.jsxs)(import_theme_ui25.Button, {
|
|
488
491
|
variant: "buttons.closeButton",
|
|
489
492
|
type: "button",
|
|
490
493
|
"aria-label": label,
|
|
491
|
-
sx: {
|
|
492
|
-
gap: "sm",
|
|
493
|
-
padding: 0,
|
|
494
|
-
...sx
|
|
495
|
-
},
|
|
496
494
|
...props,
|
|
497
495
|
ref,
|
|
498
|
-
children: [label, /* @__PURE__ */(0, import_jsx_runtime13.jsx)(Icon, {
|
|
496
|
+
children: [label, !onlyText && /* @__PURE__ */(0, import_jsx_runtime13.jsx)(Icon, {
|
|
499
497
|
icon: "close"
|
|
500
498
|
})]
|
|
501
499
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.2",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@emotion/react": "^11.10.6",
|
|
24
24
|
"@iconify-icon/react": "^1.0.7",
|
|
25
25
|
"@theme-ui/match-media": "^0.15.7",
|
|
26
|
-
"@ttoss/theme": "^1.4.
|
|
26
|
+
"@ttoss/theme": "^1.4.25",
|
|
27
27
|
"theme-ui": "^0.15.7"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a07424c53959642b5b1aedd07994091e79d63ecc"
|
|
52
52
|
}
|
|
@@ -4,24 +4,28 @@ import React from 'react';
|
|
|
4
4
|
|
|
5
5
|
export type CloseButtonProps = ButtonProps & {
|
|
6
6
|
label?: string;
|
|
7
|
+
onlyText?: boolean;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
export const CloseButton = React.forwardRef<
|
|
10
11
|
HTMLButtonElement,
|
|
11
12
|
CloseButtonProps
|
|
12
|
-
>(({ label,
|
|
13
|
+
>(({ label, onlyText, ...props }, ref) => {
|
|
14
|
+
if (onlyText && !label) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
return (
|
|
14
19
|
<Button
|
|
15
20
|
variant="buttons.closeButton"
|
|
16
21
|
type="button"
|
|
17
22
|
aria-label={label}
|
|
18
|
-
sx={{ gap: 'sm', padding: 0, ...sx }}
|
|
19
23
|
{...props}
|
|
20
24
|
ref={ref}
|
|
21
25
|
>
|
|
22
26
|
{label}
|
|
23
27
|
|
|
24
|
-
<Icon icon="close" />
|
|
28
|
+
{!onlyText && <Icon icon="close" />}
|
|
25
29
|
</Button>
|
|
26
30
|
);
|
|
27
31
|
});
|