asma-ui-core 3.126.2 → 3.126.3
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/components/inputs/button/StyledButton.js +22 -21
- package/dist/datetime/shared-components/button/StyledButton.js +10 -9
- package/dist/src/components/inputs/button/StyledButton.d.ts +3 -1
- package/dist/src/datetime/shared-components/button/StyledButton.d.ts +1 -1
- package/dist/src/table/shared-components/button/StyledButton.d.ts +1 -1
- package/dist/table/shared-components/button/StyledButton.js +10 -9
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { StyledTooltip as
|
|
2
|
-
import { LoadingIcon as
|
|
1
|
+
import { StyledTooltip as O } from "../../data-display/tooltip/StyledTooltip.js";
|
|
2
|
+
import { LoadingIcon as W } from "../../icons/loading-icon/LoadingIcon.js";
|
|
3
3
|
import e from "./StyledButton.module.js";
|
|
4
|
-
import { useReportDialogBusy as
|
|
4
|
+
import { useReportDialogBusy as _ } from "../../feedback/dialog/DialogBusyContext.js";
|
|
5
5
|
import y from "clsx";
|
|
6
6
|
import "react";
|
|
7
|
-
import { Fragment as
|
|
8
|
-
var
|
|
7
|
+
import { Fragment as F, jsx as o, jsxs as f } from "react/jsx-runtime";
|
|
8
|
+
var T = {
|
|
9
9
|
en: "In progress",
|
|
10
10
|
no: "Pågår"
|
|
11
11
|
}, x = {
|
|
@@ -19,27 +19,28 @@ var F = {
|
|
|
19
19
|
medium: e.medium,
|
|
20
20
|
error: e.error,
|
|
21
21
|
common: e.common
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
const n = r === "large" || r === "medium",
|
|
22
|
+
}, P = ({ variant: h = "contained", className: v = "", size: r = "medium", children: i, refLink: w, startIcon: b, endIcon: B, dataTest: g, error: S, style: k, disabled: c, disabledReason: p, loading: t, holdsDialog: I = !0, loadingAnnouncement: j, locale: C = "en", onClick: D, type: N = "button", ...l }) => {
|
|
23
|
+
_(!!t && I);
|
|
24
|
+
const n = r === "large" || r === "medium", R = S ? "error" : "common", s = !!c && !!p, m = s || !!t, u = n ? 20 : 16, d = (a) => t && a ? /* @__PURE__ */ o("span", {
|
|
25
25
|
style: {
|
|
26
26
|
display: "inline-flex",
|
|
27
27
|
opacity: 0
|
|
28
28
|
},
|
|
29
29
|
children: a
|
|
30
|
-
}) : a,
|
|
30
|
+
}) : a, G = (a) => {
|
|
31
31
|
if (m) {
|
|
32
32
|
a.preventDefault();
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
D?.(a);
|
|
36
|
-
},
|
|
36
|
+
}, L = /* @__PURE__ */ f("button", {
|
|
37
37
|
...l,
|
|
38
|
+
type: N,
|
|
38
39
|
disabled: !!c && !m,
|
|
39
40
|
"aria-disabled": m ? !0 : l["aria-disabled"],
|
|
40
41
|
"aria-busy": t ? !0 : l["aria-busy"],
|
|
41
|
-
onClick:
|
|
42
|
-
className: y("asma-touch-ready", e["asma-ui-core-button"], x[h], x[
|
|
42
|
+
onClick: G,
|
|
43
|
+
className: y("asma-touch-ready", e["asma-ui-core-button"], x[h], x[R], x[r], "max-xs:h-auto max-xs:max-w-full max-xs:py-1 max-xs:[&>:not(div)]:shrink-0", r === "small" ? "max-xs:min-h-8" : "max-xs:min-h-10", v),
|
|
43
44
|
style: {
|
|
44
45
|
...i ? { flexShrink: 0 } : {},
|
|
45
46
|
...t ? { position: "relative" } : {},
|
|
@@ -48,7 +49,7 @@ var F = {
|
|
|
48
49
|
ref: w,
|
|
49
50
|
"data-testid": g,
|
|
50
51
|
children: [
|
|
51
|
-
|
|
52
|
+
d(b),
|
|
52
53
|
i && /* @__PURE__ */ o("div", {
|
|
53
54
|
className: y("max-xs:hyphens-auto max-xs:whitespace-normal max-xs:![overflow-wrap:anywhere]", "max-xs:text-center"),
|
|
54
55
|
style: {
|
|
@@ -65,7 +66,7 @@ var F = {
|
|
|
65
66
|
},
|
|
66
67
|
children: i
|
|
67
68
|
}),
|
|
68
|
-
|
|
69
|
+
d(B),
|
|
69
70
|
t && /* @__PURE__ */ o("span", {
|
|
70
71
|
"aria-hidden": "true",
|
|
71
72
|
style: {
|
|
@@ -75,26 +76,26 @@ var F = {
|
|
|
75
76
|
alignItems: "center",
|
|
76
77
|
justifyContent: "center"
|
|
77
78
|
},
|
|
78
|
-
children: /* @__PURE__ */ o(
|
|
79
|
-
width:
|
|
80
|
-
height:
|
|
79
|
+
children: /* @__PURE__ */ o(W, {
|
|
80
|
+
width: u,
|
|
81
|
+
height: u
|
|
81
82
|
})
|
|
82
83
|
})
|
|
83
84
|
]
|
|
84
85
|
});
|
|
85
|
-
return /* @__PURE__ */ f(
|
|
86
|
+
return /* @__PURE__ */ f(F, { children: [/* @__PURE__ */ o(O, {
|
|
86
87
|
arrow: !0,
|
|
87
88
|
title: p,
|
|
88
89
|
open: s ? void 0 : !1,
|
|
89
90
|
openOnTap: s,
|
|
90
91
|
persistentDescription: s,
|
|
91
|
-
children:
|
|
92
|
+
children: L
|
|
92
93
|
}), t !== void 0 && /* @__PURE__ */ o("span", {
|
|
93
94
|
role: "status",
|
|
94
95
|
className: "sr-only",
|
|
95
|
-
children: t ? j ??
|
|
96
|
+
children: t ? j ?? T[C] : ""
|
|
96
97
|
})] });
|
|
97
98
|
};
|
|
98
99
|
export {
|
|
99
|
-
|
|
100
|
+
P as StyledButton
|
|
100
101
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./StyledButton.module.js";
|
|
2
|
-
import
|
|
2
|
+
import f from "clsx";
|
|
3
3
|
import "react";
|
|
4
|
-
import { jsx as
|
|
4
|
+
import { jsx as g, jsxs as y } from "react/jsx-runtime";
|
|
5
5
|
var r = {
|
|
6
6
|
contained: t.contained,
|
|
7
7
|
outlined: t.outlined,
|
|
@@ -13,16 +13,17 @@ var r = {
|
|
|
13
13
|
medium: t.medium,
|
|
14
14
|
error: t.error,
|
|
15
15
|
common: t.common
|
|
16
|
-
}, j = ({ variant:
|
|
17
|
-
const o = e === "large" || e === "medium",
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
...
|
|
20
|
-
|
|
16
|
+
}, j = ({ variant: a = "contained", className: m = "", size: e = "medium", children: n, refLink: i, startIcon: l, endIcon: d, dataTest: p, error: s, type: x = "button", ...c }) => {
|
|
17
|
+
const o = e === "large" || e === "medium", u = s ? "error" : "common";
|
|
18
|
+
return /* @__PURE__ */ y("button", {
|
|
19
|
+
...c,
|
|
20
|
+
type: x,
|
|
21
|
+
className: f(t["asma-core-ui-button"], r[a], r[u], r[e], m),
|
|
21
22
|
ref: i,
|
|
22
23
|
"data-test": p,
|
|
23
24
|
children: [
|
|
24
25
|
l,
|
|
25
|
-
|
|
26
|
+
n && /* @__PURE__ */ g("div", {
|
|
26
27
|
style: {
|
|
27
28
|
overflow: "hidden",
|
|
28
29
|
textOverflow: "ellipsis",
|
|
@@ -34,7 +35,7 @@ var r = {
|
|
|
34
35
|
paddingLeft: o ? "8px" : "4px",
|
|
35
36
|
paddingRight: o ? "8px" : "4px"
|
|
36
37
|
},
|
|
37
|
-
children:
|
|
38
|
+
children: n
|
|
38
39
|
}),
|
|
39
40
|
d
|
|
40
41
|
]
|
|
@@ -64,6 +64,8 @@ export type StyledButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
|
|
|
64
64
|
* native button pseudo-states + the `disabled` attribute, not a prop.
|
|
65
65
|
* @remarks for icon button add only startIcon prop
|
|
66
66
|
* @remarks for error button no textGray variant
|
|
67
|
+
* @remarks `type` defaults to `'button'`, not the native `'submit'`. Pass `type='submit'`
|
|
68
|
+
* explicitly for the button that submits a form.
|
|
67
69
|
*
|
|
68
70
|
* Custom props:
|
|
69
71
|
* @param variant - 'contained' | 'outlined' | 'text' | 'textGray'
|
|
@@ -74,5 +76,5 @@ export type StyledButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
|
|
|
74
76
|
* @param refLink - ref to component
|
|
75
77
|
* @param dataTest - data-test tag
|
|
76
78
|
*/
|
|
77
|
-
export declare const StyledButton: ({ variant, className, size, children, refLink, startIcon, endIcon, dataTest, error, style: styleProp, disabled, disabledReason, loading, holdsDialog, loadingAnnouncement, locale, onClick, ...otherProps }: StyledButtonProps) => JSX.Element;
|
|
79
|
+
export declare const StyledButton: ({ variant, className, size, children, refLink, startIcon, endIcon, dataTest, error, style: styleProp, disabled, disabledReason, loading, holdsDialog, loadingAnnouncement, locale, onClick, type, ...otherProps }: StyledButtonProps) => JSX.Element;
|
|
78
80
|
export {};
|
|
@@ -36,5 +36,5 @@ export type StyledButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
|
|
|
36
36
|
* @param refLink - ref to component
|
|
37
37
|
* @param dataTest - data-test tag
|
|
38
38
|
*/
|
|
39
|
-
export declare const StyledButton: ({ variant, className, size, children, refLink, startIcon, endIcon, dataTest, error, ...otherProps }: StyledButtonProps) => JSX.Element;
|
|
39
|
+
export declare const StyledButton: ({ variant, className, size, children, refLink, startIcon, endIcon, dataTest, error, type, ...otherProps }: StyledButtonProps) => JSX.Element;
|
|
40
40
|
export {};
|
|
@@ -36,5 +36,5 @@ export type StyledButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
|
|
|
36
36
|
* @param refLink - ref to component
|
|
37
37
|
* @param dataTest - data-test tag
|
|
38
38
|
*/
|
|
39
|
-
export declare const StyledButton: ({ variant, className, size, children, refLink, startIcon, endIcon, dataTest, error, ...otherProps }: StyledButtonProps) => JSX.Element;
|
|
39
|
+
export declare const StyledButton: ({ variant, className, size, children, refLink, startIcon, endIcon, dataTest, error, type, ...otherProps }: StyledButtonProps) => JSX.Element;
|
|
40
40
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./StyledButton.module.js";
|
|
2
|
-
import
|
|
2
|
+
import f from "clsx";
|
|
3
3
|
import "react";
|
|
4
|
-
import { jsx as
|
|
4
|
+
import { jsx as g, jsxs as y } from "react/jsx-runtime";
|
|
5
5
|
var r = {
|
|
6
6
|
contained: t.contained,
|
|
7
7
|
outlined: t.outlined,
|
|
@@ -13,16 +13,17 @@ var r = {
|
|
|
13
13
|
medium: t.medium,
|
|
14
14
|
error: t.error,
|
|
15
15
|
common: t.common
|
|
16
|
-
}, j = ({ variant:
|
|
17
|
-
const o = e === "large" || e === "medium",
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
...
|
|
20
|
-
|
|
16
|
+
}, j = ({ variant: a = "contained", className: m = "", size: e = "medium", children: n, refLink: i, startIcon: l, endIcon: d, dataTest: p, error: s, type: x = "button", ...c }) => {
|
|
17
|
+
const o = e === "large" || e === "medium", u = s ? "error" : "common";
|
|
18
|
+
return /* @__PURE__ */ y("button", {
|
|
19
|
+
...c,
|
|
20
|
+
type: x,
|
|
21
|
+
className: f(t["asma-core-ui-button"], r[a], r[u], r[e], m),
|
|
21
22
|
ref: i,
|
|
22
23
|
"data-test": p,
|
|
23
24
|
children: [
|
|
24
25
|
l,
|
|
25
|
-
|
|
26
|
+
n && /* @__PURE__ */ g("div", {
|
|
26
27
|
style: {
|
|
27
28
|
overflow: "hidden",
|
|
28
29
|
textOverflow: "ellipsis",
|
|
@@ -34,7 +35,7 @@ var r = {
|
|
|
34
35
|
paddingLeft: o ? "8px" : "4px",
|
|
35
36
|
paddingRight: o ? "8px" : "4px"
|
|
36
37
|
},
|
|
37
|
-
children:
|
|
38
|
+
children: n
|
|
38
39
|
}),
|
|
39
40
|
d
|
|
40
41
|
]
|