@mittwald/flow-react-components 0.1.0-alpha.157 → 0.1.0-alpha.159
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/NotificationProvider.js +18 -12
- package/dist/RadioGroup.js +69 -57
- package/dist/styles.css +1 -1
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/types/components/RadioGroup/stories/Default.stories.d.ts +1 -0
- package/dist/types/lib/getContainerBreakpointSizeClassName.d.ts +3 -0
- package/dist/types/lib/types/props.d.ts +4 -0
- package/package.json +4 -4
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var w = Object.defineProperty;
|
|
4
4
|
var A = (o, t, e) => t in o ? w(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
5
5
|
var i = (o, t, e) => A(o, typeof t != "symbol" ? t + "" : t, e);
|
|
6
|
-
import s, { useRef as v, cloneElement as
|
|
6
|
+
import s, { useRef as v, cloneElement as C, createContext as D, useContext as N } from "react";
|
|
7
7
|
import { u as E } from "./useSelector-DpU7_HMO.js";
|
|
8
8
|
import { makeObservable as g, observable as x, action as c } from "mobx";
|
|
9
9
|
import { Duration as u, DateTime as m } from "luxon";
|
|
@@ -88,12 +88,12 @@ class a {
|
|
|
88
88
|
this.notificationsData.delete(t);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
const S = "flow--notification-provider--notification-container",
|
|
91
|
+
const S = "flow--notification-provider--notification-container", B = "flow--notification-provider--notification", d = {
|
|
92
92
|
notificationContainer: S,
|
|
93
|
-
notification:
|
|
94
|
-
},
|
|
93
|
+
notification: B
|
|
94
|
+
}, O = (o) => {
|
|
95
95
|
const { notification: t, controller: e } = o;
|
|
96
|
-
return
|
|
96
|
+
return C(t.element, {
|
|
97
97
|
onMouseEnter: () => {
|
|
98
98
|
t.meta.autoCloseTimer.pause();
|
|
99
99
|
},
|
|
@@ -102,10 +102,16 @@ const S = "flow--notification-provider--notification-container", O = "flow--noti
|
|
|
102
102
|
},
|
|
103
103
|
onClose: () => {
|
|
104
104
|
e.remove(t.meta.id);
|
|
105
|
+
},
|
|
106
|
+
onFocus: () => {
|
|
107
|
+
t.meta.autoCloseTimer.pause();
|
|
108
|
+
},
|
|
109
|
+
onBlur: () => {
|
|
110
|
+
t.meta.autoCloseTimer.resume();
|
|
105
111
|
}
|
|
106
112
|
});
|
|
107
|
-
},
|
|
108
|
-
const { className: t, ...e } = o, n =
|
|
113
|
+
}, z = (o) => {
|
|
114
|
+
const { className: t, ...e } = o, n = F(), f = n.useNotifications(), h = L(), p = b(d.notificationContainer, t), T = /* @__PURE__ */ s.createElement(I, { features: M }, /* @__PURE__ */ s.createElement("div", { className: p, ...e }, /* @__PURE__ */ s.createElement(P, null, f.map((r) => /* @__PURE__ */ s.createElement(
|
|
109
115
|
k.div,
|
|
110
116
|
{
|
|
111
117
|
className: d.notification,
|
|
@@ -118,7 +124,7 @@ const S = "flow--notification-provider--notification-container", O = "flow--noti
|
|
|
118
124
|
}
|
|
119
125
|
},
|
|
120
126
|
/* @__PURE__ */ s.createElement(
|
|
121
|
-
|
|
127
|
+
O,
|
|
122
128
|
{
|
|
123
129
|
notification: r,
|
|
124
130
|
controller: n
|
|
@@ -126,14 +132,14 @@ const S = "flow--notification-provider--notification-container", O = "flow--noti
|
|
|
126
132
|
)
|
|
127
133
|
)))));
|
|
128
134
|
return h ? null : y.createPortal(T, document.body);
|
|
129
|
-
}, l =
|
|
135
|
+
}, l = D(
|
|
130
136
|
new a()
|
|
131
|
-
),
|
|
137
|
+
), F = () => N(l), W = (o) => {
|
|
132
138
|
const { children: t, ...e } = o, n = a.useNew();
|
|
133
|
-
return /* @__PURE__ */ s.createElement(l.Provider, { value: n }, /* @__PURE__ */ s.createElement(
|
|
139
|
+
return /* @__PURE__ */ s.createElement(l.Provider, { value: n }, /* @__PURE__ */ s.createElement(z, { ...e }), t);
|
|
134
140
|
};
|
|
135
141
|
export {
|
|
136
142
|
W as NotificationProvider,
|
|
137
143
|
W as default,
|
|
138
|
-
|
|
144
|
+
F as useNotificationController
|
|
139
145
|
};
|
package/dist/RadioGroup.js
CHANGED
|
@@ -1,37 +1,43 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import e from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as k from "react-aria-components";
|
|
5
5
|
import E from "clsx";
|
|
6
6
|
import "./propsContext-DzAKlmhS.js";
|
|
7
|
-
import { P as C, m as
|
|
7
|
+
import { P as C, m as z } from "./PropsContextProvider-C6Z4XGp6.js";
|
|
8
8
|
import "@react-aria/utils";
|
|
9
9
|
import "remeda";
|
|
10
|
-
import { d as
|
|
11
|
-
import { F as
|
|
12
|
-
import { C as
|
|
13
|
-
import { TunnelProvider as
|
|
14
|
-
import { s as
|
|
15
|
-
import { d as
|
|
16
|
-
import { C as
|
|
10
|
+
import { d as h } from "./dynamic-ClpUSmEt.js";
|
|
11
|
+
import { F as B } from "./FieldError-Dab589IV.js";
|
|
12
|
+
import { C as I } from "./ColumnLayout-FMONjI17.js";
|
|
13
|
+
import { TunnelProvider as P, TunnelExit as c } from "@mittwald/react-tunnel";
|
|
14
|
+
import { s as m } from "./FormField.module-DHK6nIcD.js";
|
|
15
|
+
import { d as y } from "./deepFindOfType-6pG0fH7S.js";
|
|
16
|
+
import { C as b } from "./ClearPropsContext-CUvsbMn8.js";
|
|
17
17
|
import "@tabler/icons-react";
|
|
18
18
|
import "./Icon-BcUUAuaS.js";
|
|
19
|
-
import { I as
|
|
19
|
+
import { I as F, a as v } from "./IconRadioOn-D56UzZk_.js";
|
|
20
20
|
import { f as N } from "./flowComponent-DDs2bWU2.js";
|
|
21
21
|
import "dot-prop";
|
|
22
22
|
import { I as D } from "./IconCheck-DCcrnlQY.js";
|
|
23
|
-
const T = "flow--radio-group",
|
|
23
|
+
const T = "flow--radio-group", $ = "flow--radio-group--segmented-group", O = "flow--radio-group--segments", L = "flow--radio-group--segment", S = "flow--radio-group--checkmark", A = "flow--radio-group--radio-group-container", r = {
|
|
24
24
|
radioGroup: T,
|
|
25
|
-
segmentedGroup:
|
|
26
|
-
segments:
|
|
25
|
+
segmentedGroup: $,
|
|
26
|
+
segments: O,
|
|
27
27
|
segment: L,
|
|
28
|
-
checkmark:
|
|
29
|
-
|
|
28
|
+
checkmark: S,
|
|
29
|
+
radioGroupContainer: A,
|
|
30
|
+
"container-breakpoint-size-xs": "flow--radio-group--container-breakpoint-size-xs",
|
|
31
|
+
"container-breakpoint-size-s": "flow--radio-group--container-breakpoint-size-s",
|
|
32
|
+
"container-breakpoint-size-m": "flow--radio-group--container-breakpoint-size-m",
|
|
33
|
+
"container-breakpoint-size-l": "flow--radio-group--container-breakpoint-size-l",
|
|
34
|
+
"container-breakpoint-size-xl": "flow--radio-group--container-breakpoint-size-xl"
|
|
35
|
+
}, j = "flow--radio-group--radio-button", q = "flow--radio-group--radio-button--content", H = "flow--radio-group--radio-button--label", f = {
|
|
30
36
|
radioButton: j,
|
|
31
37
|
content: q,
|
|
32
|
-
label:
|
|
33
|
-
},
|
|
34
|
-
const { children:
|
|
38
|
+
label: H
|
|
39
|
+
}, J = N("RadioButton", (t) => {
|
|
40
|
+
const { children: a, className: n, refProp: o, ...i } = t, s = E(f.radioButton, n), l = {
|
|
35
41
|
Text: {
|
|
36
42
|
className: f.label
|
|
37
43
|
},
|
|
@@ -39,28 +45,34 @@ const T = "flow--radio-group", O = "flow--radio-group--segmented-group", $ = "fl
|
|
|
39
45
|
className: f.content
|
|
40
46
|
}
|
|
41
47
|
};
|
|
42
|
-
return /* @__PURE__ */ e.createElement(
|
|
43
|
-
}),
|
|
48
|
+
return /* @__PURE__ */ e.createElement(b, null, /* @__PURE__ */ e.createElement(U, { ...i, className: s, ref: o }, /* @__PURE__ */ e.createElement(C, { props: l }, a)));
|
|
49
|
+
}), K = (t) => `container-breakpoint-size-${t}`, ue = N("RadioGroup", (t) => {
|
|
44
50
|
const {
|
|
45
|
-
children:
|
|
46
|
-
className:
|
|
51
|
+
children: a,
|
|
52
|
+
className: n,
|
|
47
53
|
variant: o = "default",
|
|
48
|
-
s,
|
|
49
|
-
m:
|
|
50
|
-
l
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
s: i,
|
|
55
|
+
m: s,
|
|
56
|
+
l,
|
|
57
|
+
containerBreakpointSize: d = "m",
|
|
58
|
+
refProp: w,
|
|
59
|
+
...R
|
|
60
|
+
} = t, x = E(
|
|
61
|
+
m.formField,
|
|
62
|
+
r.radioGroupContainer,
|
|
63
|
+
n,
|
|
64
|
+
r[K(d)]
|
|
65
|
+
);
|
|
54
66
|
let p = {
|
|
55
67
|
Label: {
|
|
56
|
-
className:
|
|
68
|
+
className: m.label
|
|
57
69
|
},
|
|
58
70
|
FieldDescription: {
|
|
59
|
-
className:
|
|
71
|
+
className: m.fieldDescription,
|
|
60
72
|
tunnelId: "fieldDescription"
|
|
61
73
|
},
|
|
62
74
|
FieldError: {
|
|
63
|
-
className:
|
|
75
|
+
className: m.customFieldError,
|
|
64
76
|
tunnelId: "fieldError"
|
|
65
77
|
},
|
|
66
78
|
RadioButton: {
|
|
@@ -70,46 +82,46 @@ const T = "flow--radio-group", O = "flow--radio-group--segmented-group", $ = "fl
|
|
|
70
82
|
tunnelId: "radios"
|
|
71
83
|
}
|
|
72
84
|
};
|
|
73
|
-
o === "segmented" && (p =
|
|
85
|
+
o === "segmented" && (p = z(p, {
|
|
74
86
|
Radio: {
|
|
75
|
-
className:
|
|
87
|
+
className: r.segment,
|
|
76
88
|
unstyled: !0,
|
|
77
|
-
children:
|
|
89
|
+
children: h((G) => /* @__PURE__ */ e.createElement(e.Fragment, null, G.children, /* @__PURE__ */ e.createElement(D, { className: r.checkmark })))
|
|
78
90
|
}
|
|
79
91
|
}));
|
|
80
|
-
const u = !!
|
|
92
|
+
const u = !!y(a, J);
|
|
81
93
|
return o === "segmented" && u && console.warn(
|
|
82
94
|
"<RadioButton/> is not supported in 'segmented' variant of <RadioGroup />"
|
|
83
|
-
), /* @__PURE__ */ e.createElement(
|
|
95
|
+
), /* @__PURE__ */ e.createElement(k.RadioGroup, { ...R, className: x, ref: w }, /* @__PURE__ */ e.createElement(P, null, /* @__PURE__ */ e.createElement(
|
|
84
96
|
C,
|
|
85
97
|
{
|
|
86
98
|
props: p,
|
|
87
99
|
dependencies: [o],
|
|
88
100
|
mergeInParentContext: !0
|
|
89
101
|
},
|
|
90
|
-
|
|
91
|
-
o === "segmented" && /* @__PURE__ */ e.createElement("div", { className:
|
|
92
|
-
o === "default" && u && /* @__PURE__ */ e.createElement(
|
|
93
|
-
o === "default" && !u && /* @__PURE__ */ e.createElement("div", { className:
|
|
94
|
-
/* @__PURE__ */ e.createElement(
|
|
95
|
-
/* @__PURE__ */ e.createElement(
|
|
96
|
-
)), /* @__PURE__ */ e.createElement(
|
|
97
|
-
}),
|
|
98
|
-
radio:
|
|
99
|
-
icon:
|
|
100
|
-
},
|
|
102
|
+
a,
|
|
103
|
+
o === "segmented" && /* @__PURE__ */ e.createElement("div", { className: r.segmentedGroup }, /* @__PURE__ */ e.createElement("div", { className: r.segments }, /* @__PURE__ */ e.createElement(c, { id: "radios" }))),
|
|
104
|
+
o === "default" && u && /* @__PURE__ */ e.createElement(I, { s: i, m: s, l, className: r.radioGroup }, /* @__PURE__ */ e.createElement(c, { id: "radios" })),
|
|
105
|
+
o === "default" && !u && /* @__PURE__ */ e.createElement("div", { className: r.radioGroup }, /* @__PURE__ */ e.createElement(c, { id: "radios" })),
|
|
106
|
+
/* @__PURE__ */ e.createElement(c, { id: "fieldDescription" }),
|
|
107
|
+
/* @__PURE__ */ e.createElement(c, { id: "fieldError" })
|
|
108
|
+
)), /* @__PURE__ */ e.createElement(B, { className: m.fieldError }));
|
|
109
|
+
}), M = "flow--radio-group--radio", Q = "flow--radio-group--radio--icon", g = {
|
|
110
|
+
radio: M,
|
|
111
|
+
icon: Q
|
|
112
|
+
}, U = N("Radio", (t) => {
|
|
101
113
|
const {
|
|
102
|
-
children:
|
|
103
|
-
className:
|
|
114
|
+
children: a,
|
|
115
|
+
className: n,
|
|
104
116
|
unstyled: o = !1,
|
|
105
|
-
refProp:
|
|
106
|
-
...
|
|
107
|
-
} =
|
|
108
|
-
return /* @__PURE__ */ e.createElement(
|
|
117
|
+
refProp: i,
|
|
118
|
+
...s
|
|
119
|
+
} = t, l = o ? n : E(g.radio, n);
|
|
120
|
+
return /* @__PURE__ */ e.createElement(b, null, /* @__PURE__ */ e.createElement(k.Radio, { ...s, className: l, ref: i }, ({ isSelected: d }) => /* @__PURE__ */ e.createElement(e.Fragment, null, d ? !o && /* @__PURE__ */ e.createElement(F, { className: g.icon }) : !o && /* @__PURE__ */ e.createElement(v, { className: g.icon }), a)));
|
|
109
121
|
});
|
|
110
122
|
export {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
U as Radio,
|
|
124
|
+
J as RadioButton,
|
|
125
|
+
ue as RadioGroup,
|
|
126
|
+
ue as default
|
|
115
127
|
};
|