asma-ui-core 3.127.1 → 3.128.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/asma-ui-core.css +1 -1
- package/dist/components/custom/widget/widget/StyledWidget.js +41 -37
- package/dist/components/custom/widget/widget/StyledWidget.module.js +9 -8
- package/dist/components/inputs/emoji-choice/StyledEmojiChoice.js +259 -0
- package/dist/components/inputs/emoji-choice/StyledEmojiChoice.module.js +27 -0
- package/dist/components/inputs/radio-button/base-ui/StyledRadio.js +15 -15
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +84 -84
- package/dist/index.js +162 -160
- package/dist/src/components/custom/widget/widget/StyledWidget.d.ts +3 -2
- package/dist/src/components/custom/widget/widget/StyledWidget.test.d.ts +1 -0
- package/dist/src/components/inputs/emoji-choice/StyledEmojiChoice.d.ts +37 -0
- package/dist/src/components/inputs/emoji-choice/index.d.ts +1 -0
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +3 -1
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,77 +1,81 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import
|
|
3
|
-
import { StyledButton as
|
|
4
|
-
import { StyledEmptyPage as
|
|
5
|
-
import { StyledLoading as
|
|
6
|
-
import { StyledLink as
|
|
7
|
-
import { StyledWidgetTitle as
|
|
1
|
+
import { cn as s } from "../../../../helpers/cn.js";
|
|
2
|
+
import N from "../icons/ChevronDownIcon.js";
|
|
3
|
+
import { StyledButton as b } from "../../../inputs/button/StyledButton.js";
|
|
4
|
+
import { StyledEmptyPage as C } from "../../../feedback/empty-page/StyledEmptyPage.js";
|
|
5
|
+
import { StyledLoading as I } from "../../../feedback/loading/StyledLoading.js";
|
|
6
|
+
import { StyledLink as v } from "../../../navigation/link/StyledLink.js";
|
|
7
|
+
import { StyledWidgetTitle as T } from "../widget-title/StyledWidgetTitle.js";
|
|
8
8
|
import a from "./StyledWidget.module.js";
|
|
9
|
-
import
|
|
10
|
-
import { useState as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
var
|
|
13
|
-
const [
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
className: `${a["asma-ui-core-styled-widget"]} ${
|
|
9
|
+
import k from "../icons/ChevronUpIcon.js";
|
|
10
|
+
import { useState as L } from "react";
|
|
11
|
+
import { Fragment as R, jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
12
|
+
var V = ({ children: m, title: c, titleNode: h, icon: n, link: l, viewMore: t, persistKey: o, isLoading: g, isEmpty: r, emptyText: f, headerRight: x, headerRightClassName: p }) => {
|
|
13
|
+
const [d, w] = L(() => o ? localStorage.getItem(o) === "true" : !1), u = !!l && !l.hide, S = !!t && !t.hide, y = !!t?.disabled && !d && t?.disabledReason != null;
|
|
14
|
+
return /* @__PURE__ */ i("div", {
|
|
15
|
+
className: `${a["asma-ui-core-styled-widget"]} ${r ? a["empty-state"] : ""}`,
|
|
16
16
|
children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
className:
|
|
17
|
+
/* @__PURE__ */ i("div", {
|
|
18
|
+
className: s(a["widget-header-left"], "max-xs:flex-wrap max-xs:gap-y-2"),
|
|
19
19
|
children: [
|
|
20
20
|
n && /* @__PURE__ */ e("span", {
|
|
21
21
|
className: "flex shrink-0",
|
|
22
22
|
children: n
|
|
23
23
|
}),
|
|
24
|
-
h ?? /* @__PURE__ */ e(
|
|
24
|
+
h ?? /* @__PURE__ */ e(T, {
|
|
25
25
|
className: "min-w-min",
|
|
26
26
|
children: c
|
|
27
27
|
}),
|
|
28
28
|
/* @__PURE__ */ e("div", {
|
|
29
|
-
className:
|
|
29
|
+
className: s(a["widget-header-right"], "max-xs:flex-wrap max-xs:gap-y-2", p),
|
|
30
30
|
children: x
|
|
31
31
|
})
|
|
32
32
|
]
|
|
33
33
|
}),
|
|
34
34
|
/* @__PURE__ */ e("div", {
|
|
35
35
|
className: a["widget-content"],
|
|
36
|
-
children: /* @__PURE__ */
|
|
37
|
-
|
|
38
|
-
/* @__PURE__ */ e(
|
|
39
|
-
/* @__PURE__ */ e(
|
|
40
|
-
isEmpty:
|
|
36
|
+
children: /* @__PURE__ */ i(R, { children: [
|
|
37
|
+
m,
|
|
38
|
+
/* @__PURE__ */ e(I, { isLoading: g }),
|
|
39
|
+
/* @__PURE__ */ e(C, {
|
|
40
|
+
isEmpty: r,
|
|
41
41
|
emptyText: f
|
|
42
42
|
})
|
|
43
43
|
] })
|
|
44
44
|
}),
|
|
45
|
-
S && /* @__PURE__ */
|
|
46
|
-
className:
|
|
47
|
-
children: [
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
S && /* @__PURE__ */ i("div", {
|
|
46
|
+
className: s(a["widget-footer"], "max-xs:flex-wrap max-xs:gap-y-2"),
|
|
47
|
+
children: [y ? /* @__PURE__ */ e("p", {
|
|
48
|
+
className: a["widget-all-shown"],
|
|
49
|
+
"data-testid": "all-items-shown",
|
|
50
|
+
children: t.disabledReason
|
|
51
|
+
}) : /* @__PURE__ */ e(b, {
|
|
50
52
|
dataTest: "view-more",
|
|
51
53
|
variant: "text",
|
|
52
|
-
|
|
54
|
+
disabled: !!t.disabled && !d,
|
|
55
|
+
disabledReason: d ? void 0 : t.disabledReason,
|
|
56
|
+
endIcon: d ? /* @__PURE__ */ e(k, {
|
|
53
57
|
width: 20,
|
|
54
58
|
height: 20
|
|
55
|
-
}) : /* @__PURE__ */ e(
|
|
59
|
+
}) : /* @__PURE__ */ e(N, {
|
|
56
60
|
width: 20,
|
|
57
61
|
height: 20
|
|
58
62
|
}),
|
|
59
63
|
onClick: () => {
|
|
60
|
-
w(!
|
|
64
|
+
w(!d), o && localStorage.setItem(o, String(!d)), t.onClick?.();
|
|
61
65
|
},
|
|
62
|
-
children:
|
|
63
|
-
}), u ? /* @__PURE__ */ e(
|
|
66
|
+
children: d ? t.viewLessText : t.viewMoreText
|
|
67
|
+
}), u ? /* @__PURE__ */ e(v, {
|
|
64
68
|
dataTest: "go-to-button",
|
|
65
69
|
className: a["widget-link"],
|
|
66
70
|
size: "large",
|
|
67
|
-
href:
|
|
68
|
-
onClick:
|
|
69
|
-
content:
|
|
71
|
+
href: l.href,
|
|
72
|
+
onClick: l.onClick,
|
|
73
|
+
content: l.content
|
|
70
74
|
}) : /* @__PURE__ */ e("div", {})]
|
|
71
75
|
})
|
|
72
76
|
]
|
|
73
77
|
});
|
|
74
78
|
};
|
|
75
79
|
export {
|
|
76
|
-
|
|
80
|
+
V as StyledWidget
|
|
77
81
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
"asma-ui-core-styled-widget": "_asma-ui-core-styled-
|
|
3
|
-
"empty-state": "_empty-
|
|
4
|
-
"widget-header": "_widget-
|
|
5
|
-
"widget-header-left": "_widget-header-
|
|
6
|
-
"widget-header-right": "_widget-header-
|
|
7
|
-
"widget-content": "_widget-
|
|
8
|
-
"widget-footer": "_widget-
|
|
9
|
-
"widget-
|
|
2
|
+
"asma-ui-core-styled-widget": "_asma-ui-core-styled-widget_ehofp_1",
|
|
3
|
+
"empty-state": "_empty-state_ehofp_13",
|
|
4
|
+
"widget-header": "_widget-header_ehofp_16",
|
|
5
|
+
"widget-header-left": "_widget-header-left_ehofp_22",
|
|
6
|
+
"widget-header-right": "_widget-header-right_ehofp_28",
|
|
7
|
+
"widget-content": "_widget-content_ehofp_34",
|
|
8
|
+
"widget-footer": "_widget-footer_ehofp_44",
|
|
9
|
+
"widget-all-shown": "_widget-all-shown_ehofp_49",
|
|
10
|
+
"widget-link": "_widget-link_ehofp_59"
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
13
|
e as default
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { cn as u } from "../../../helpers/cn.js";
|
|
2
|
+
import { ChevronDownIcon as P } from "../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
3
|
+
import { StyledRadio as $ } from "../radio-button/base-ui/StyledRadio.js";
|
|
4
|
+
import { StyledButton as x } from "../button/StyledButton.js";
|
|
5
|
+
import { HelperRow as H } from "../../../helpers/HelperRow.js";
|
|
6
|
+
import { useHelperSlot as q } from "../../../helpers/useHelperSlot.js";
|
|
7
|
+
import { StyledInputField as D } from "../input-field/StyledInputField.js";
|
|
8
|
+
import { getPickerText as L } from "../full-screen-picker/pickerCopy.js";
|
|
9
|
+
import { StyledSelectAutocomplete as F } from "../select-autocomplete/StyledSelectAutocomplete.js";
|
|
10
|
+
import a from "./StyledEmojiChoice.module.js";
|
|
11
|
+
import { useId as j, useRef as M, useState as T } from "react";
|
|
12
|
+
import { jsx as l, jsxs as f } from "react/jsx-runtime";
|
|
13
|
+
var V = {
|
|
14
|
+
en: {
|
|
15
|
+
noAnswer: "No answer",
|
|
16
|
+
showAllOptions: (e) => `Show all options (${e})`,
|
|
17
|
+
hideOptions: "Hide options",
|
|
18
|
+
selected: "selected",
|
|
19
|
+
option: (e) => `Option ${e}`
|
|
20
|
+
},
|
|
21
|
+
no: {
|
|
22
|
+
noAnswer: "Ingen svar",
|
|
23
|
+
showAllOptions: (e) => `Vis alle alternativ (${e})`,
|
|
24
|
+
hideOptions: "Skjul alternativ",
|
|
25
|
+
selected: "valgt",
|
|
26
|
+
option: (e) => `Alternativ ${e}`
|
|
27
|
+
}
|
|
28
|
+
}, K = 5, C = (e, n, h) => e.label ? e.label : e.emoji ? e.emoji : h.option(n), R = ({ option: e, className: n }) => e.emoji ? /* @__PURE__ */ l("span", {
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
className: n,
|
|
31
|
+
children: e.emoji
|
|
32
|
+
}) : e.emojiImageSrc ? /* @__PURE__ */ l("img", {
|
|
33
|
+
alt: "",
|
|
34
|
+
src: e.emojiImageSrc,
|
|
35
|
+
className: n
|
|
36
|
+
}) : null, S = ({ option: e, position: n, text: h, radio: N }) => {
|
|
37
|
+
const p = !!e.emoji || !!e.emojiImageSrc;
|
|
38
|
+
return /* @__PURE__ */ f("span", {
|
|
39
|
+
className: u(a.content, !p && a.noEmoji),
|
|
40
|
+
children: [/* @__PURE__ */ f("span", {
|
|
41
|
+
className: a.lead,
|
|
42
|
+
children: [N, p && /* @__PURE__ */ l("span", {
|
|
43
|
+
className: a.emojiSlot,
|
|
44
|
+
children: /* @__PURE__ */ l(R, {
|
|
45
|
+
option: e,
|
|
46
|
+
className: a.emoji
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
}), e.label ? /* @__PURE__ */ l("span", {
|
|
50
|
+
className: a.text,
|
|
51
|
+
children: e.label
|
|
52
|
+
}) : /* @__PURE__ */ l("span", {
|
|
53
|
+
className: "sr-only",
|
|
54
|
+
children: C(e, n, h)
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
}, X = (e) => {
|
|
58
|
+
e.key === "Enter" && (e.preventDefault(), e.currentTarget.click());
|
|
59
|
+
}, B = ({ dataTest: e, options: n, value: h, onValueChange: N, question: p, "aria-labelledby": y, name: m, error: o, helperText: b, className: O, text: w }) => {
|
|
60
|
+
const v = j(), c = j(), { show: s, role: g } = q("StyledEmojiChoice", o, b);
|
|
61
|
+
return /* @__PURE__ */ f("fieldset", {
|
|
62
|
+
role: "group",
|
|
63
|
+
"aria-labelledby": y,
|
|
64
|
+
"aria-describedby": s ? c : void 0,
|
|
65
|
+
"data-testid": e,
|
|
66
|
+
className: u(a.group, O),
|
|
67
|
+
children: [
|
|
68
|
+
!y && /* @__PURE__ */ l("legend", {
|
|
69
|
+
className: a.question,
|
|
70
|
+
children: p
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ l("div", {
|
|
73
|
+
className: a.options,
|
|
74
|
+
children: n.map((d, t) => {
|
|
75
|
+
const I = d.value === h;
|
|
76
|
+
return /* @__PURE__ */ f("label", {
|
|
77
|
+
"data-testid": `${e}-option-${t}`,
|
|
78
|
+
className: u(a.card, a.choice, !d.label && a.fit),
|
|
79
|
+
children: [/* @__PURE__ */ l("input", {
|
|
80
|
+
type: "radio",
|
|
81
|
+
className: "sr-only",
|
|
82
|
+
name: m ?? v,
|
|
83
|
+
value: d.value,
|
|
84
|
+
checked: I,
|
|
85
|
+
onChange: () => N?.(d.value, d),
|
|
86
|
+
onKeyDown: X
|
|
87
|
+
}), /* @__PURE__ */ l("span", {
|
|
88
|
+
className: a.body,
|
|
89
|
+
children: /* @__PURE__ */ l(S, {
|
|
90
|
+
option: d,
|
|
91
|
+
position: t + 1,
|
|
92
|
+
text: w,
|
|
93
|
+
radio: /* @__PURE__ */ l($, {
|
|
94
|
+
decorative: !0,
|
|
95
|
+
checked: I
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
})]
|
|
99
|
+
}, `${t}-${d.value}`);
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
s && /* @__PURE__ */ l(H, {
|
|
103
|
+
id: c,
|
|
104
|
+
role: g,
|
|
105
|
+
error: o,
|
|
106
|
+
message: b,
|
|
107
|
+
className: u("m-0", o && "font-medium")
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}, G = ({ dataTest: e, options: n, value: h, onValueChange: N, question: p, "aria-labelledby": y, error: m, helperText: o, placeholder: b, locale: O, className: w, text: v }) => {
|
|
112
|
+
const c = j(), [s, g] = T(null), d = M(!1), t = n.find((r) => r.value === h) ?? null, I = t ? C(t, n.indexOf(t) + 1, v) : "", _ = s === null && t !== null && (t.label !== "" || !t.emoji);
|
|
113
|
+
return /* @__PURE__ */ f("div", {
|
|
114
|
+
className: u(a.dropdown, w),
|
|
115
|
+
children: [!y && /* @__PURE__ */ l("span", {
|
|
116
|
+
id: c,
|
|
117
|
+
className: a.question,
|
|
118
|
+
children: p
|
|
119
|
+
}), /* @__PURE__ */ l(F, {
|
|
120
|
+
dataTest: e,
|
|
121
|
+
options: n,
|
|
122
|
+
value: t,
|
|
123
|
+
onChange: (r, i) => {
|
|
124
|
+
i && N?.(i.value, i);
|
|
125
|
+
},
|
|
126
|
+
getOptionLabel: (r) => C(r, n.indexOf(r) + 1, v),
|
|
127
|
+
getOptionKey: (r) => r.value,
|
|
128
|
+
isOptionEqualToValue: (r, i) => r.value === i.value,
|
|
129
|
+
inputValue: s ?? I,
|
|
130
|
+
onInputChange: (r, i, A) => g(A === "input" ? i : null),
|
|
131
|
+
onClose: () => g(null),
|
|
132
|
+
disableClearable: !0,
|
|
133
|
+
error: m,
|
|
134
|
+
helperText: o,
|
|
135
|
+
pickerTitle: p,
|
|
136
|
+
locale: O,
|
|
137
|
+
noOptionsText: L(O ?? "en").noMatches,
|
|
138
|
+
maxListHeight: 322,
|
|
139
|
+
slotProps: { popper: { className: a.menu } },
|
|
140
|
+
renderOption: ({ key: r, className: i, ...A }, E, k) => /* @__PURE__ */ l("li", {
|
|
141
|
+
...A,
|
|
142
|
+
className: u(a.menuOption, k.inPicker && a.pickerOption),
|
|
143
|
+
children: /* @__PURE__ */ l("span", {
|
|
144
|
+
className: u(a.card, a.body),
|
|
145
|
+
children: /* @__PURE__ */ l(S, {
|
|
146
|
+
option: E,
|
|
147
|
+
position: n.indexOf(E) + 1,
|
|
148
|
+
text: v,
|
|
149
|
+
radio: /* @__PURE__ */ l($, {
|
|
150
|
+
decorative: !0,
|
|
151
|
+
checked: k.selected
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
}, r),
|
|
156
|
+
renderInput: (r) => /* @__PURE__ */ l(D, {
|
|
157
|
+
...r,
|
|
158
|
+
dataTest: `${e}-input`,
|
|
159
|
+
placeholder: b,
|
|
160
|
+
onFocus: (i) => {
|
|
161
|
+
r.onFocus?.(), i.currentTarget.select(), d.current = !0;
|
|
162
|
+
},
|
|
163
|
+
onClick: (i) => {
|
|
164
|
+
d.current && i.target instanceof HTMLInputElement && i.target.select(), d.current = !1;
|
|
165
|
+
},
|
|
166
|
+
slotProps: {
|
|
167
|
+
htmlInput: {
|
|
168
|
+
...r.slotProps.htmlInput,
|
|
169
|
+
"aria-labelledby": y ?? c
|
|
170
|
+
},
|
|
171
|
+
input: {
|
|
172
|
+
...r.slotProps.input,
|
|
173
|
+
startAdornment: t && _ ? /* @__PURE__ */ l(R, {
|
|
174
|
+
option: t,
|
|
175
|
+
className: a.fieldEmoji
|
|
176
|
+
}) : void 0
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
}, z = ({ dataTest: e, options: n, value: h, question: N, "aria-labelledby": p, className: y, text: m }) => {
|
|
183
|
+
const [o, b] = T(!1), O = j(), w = j(), v = j(), c = n.find((s) => s.value === h);
|
|
184
|
+
return /* @__PURE__ */ f("dl", {
|
|
185
|
+
"data-testid": e,
|
|
186
|
+
className: u(a.readOnly, y),
|
|
187
|
+
children: [/* @__PURE__ */ l("dt", {
|
|
188
|
+
id: O,
|
|
189
|
+
className: p ? "sr-only" : a.question,
|
|
190
|
+
children: N
|
|
191
|
+
}), /* @__PURE__ */ f("dd", {
|
|
192
|
+
className: a.readOnlyAnswer,
|
|
193
|
+
children: [/* @__PURE__ */ f("div", {
|
|
194
|
+
className: a.readOnlyCard,
|
|
195
|
+
children: [c ? /* @__PURE__ */ l(S, {
|
|
196
|
+
option: c,
|
|
197
|
+
position: n.indexOf(c) + 1,
|
|
198
|
+
text: m
|
|
199
|
+
}) : /* @__PURE__ */ l("span", {
|
|
200
|
+
className: a.noAnswer,
|
|
201
|
+
children: m.noAnswer
|
|
202
|
+
}), n.length > 0 && /* @__PURE__ */ l(x, {
|
|
203
|
+
dataTest: `${e}-show-all`,
|
|
204
|
+
variant: "text",
|
|
205
|
+
type: "button",
|
|
206
|
+
className: a.showAll,
|
|
207
|
+
"aria-expanded": o,
|
|
208
|
+
"aria-controls": v,
|
|
209
|
+
"aria-labelledby": `${w} ${O}`,
|
|
210
|
+
endIcon: /* @__PURE__ */ l(P, {
|
|
211
|
+
width: 24,
|
|
212
|
+
height: 24,
|
|
213
|
+
className: u(o && "flip-180")
|
|
214
|
+
}),
|
|
215
|
+
onClick: () => b(!o),
|
|
216
|
+
children: /* @__PURE__ */ l("span", {
|
|
217
|
+
id: w,
|
|
218
|
+
children: o ? m.hideOptions : m.showAllOptions(n.length)
|
|
219
|
+
})
|
|
220
|
+
})]
|
|
221
|
+
}), /* @__PURE__ */ l("ul", {
|
|
222
|
+
id: v,
|
|
223
|
+
hidden: !o,
|
|
224
|
+
className: a.options,
|
|
225
|
+
children: n.map((s, g) => /* @__PURE__ */ f("li", {
|
|
226
|
+
className: u(a.card, a.body, !s.label && a.fit),
|
|
227
|
+
children: [/* @__PURE__ */ l(S, {
|
|
228
|
+
option: s,
|
|
229
|
+
position: g + 1,
|
|
230
|
+
text: m,
|
|
231
|
+
radio: /* @__PURE__ */ l($, {
|
|
232
|
+
decorative: !0,
|
|
233
|
+
readOnly: !0,
|
|
234
|
+
checked: s === c
|
|
235
|
+
})
|
|
236
|
+
}), s === c && /* @__PURE__ */ l("span", {
|
|
237
|
+
className: "sr-only",
|
|
238
|
+
children: `, ${m.selected}`
|
|
239
|
+
})]
|
|
240
|
+
}, `${g}-${s.value}`))
|
|
241
|
+
})]
|
|
242
|
+
})]
|
|
243
|
+
});
|
|
244
|
+
}, te = (e) => {
|
|
245
|
+
const n = V[e.locale ?? "en"];
|
|
246
|
+
return e.readOnly ? /* @__PURE__ */ l(z, {
|
|
247
|
+
...e,
|
|
248
|
+
text: n
|
|
249
|
+
}) : e.options.length > K ? /* @__PURE__ */ l(G, {
|
|
250
|
+
...e,
|
|
251
|
+
text: n
|
|
252
|
+
}) : /* @__PURE__ */ l(B, {
|
|
253
|
+
...e,
|
|
254
|
+
text: n
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
export {
|
|
258
|
+
te as StyledEmojiChoice
|
|
259
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var _ = "_group_xgzbu_1", r = "_question_xgzbu_9", o = "_options_xgzbu_19", a = "_card_xgzbu_31", e = "_body_xgzbu_45", u = "_fit_xgzbu_52", n = "_choice_xgzbu_57", i = "_content_xgzbu_86", x = "_noEmoji_xgzbu_94", b = "_readOnlyCard_xgzbu_97", d = "_lead_xgzbu_101", g = "_emojiSlot_xgzbu_109", t = "_emoji_xgzbu_109", v = "_text_xgzbu_131", z = "_dropdown_xgzbu_139", l = "_fieldEmoji_xgzbu_144", p = "_menuOption_xgzbu_156", m = "_pickerOption_xgzbu_165", c = "_readOnly_xgzbu_97", s = "_readOnlyAnswer_xgzbu_200", O = "_noAnswer_xgzbu_220", j = "_showAll_xgzbu_224", y = {
|
|
2
|
+
group: _,
|
|
3
|
+
question: r,
|
|
4
|
+
options: o,
|
|
5
|
+
card: a,
|
|
6
|
+
body: e,
|
|
7
|
+
fit: u,
|
|
8
|
+
choice: n,
|
|
9
|
+
content: i,
|
|
10
|
+
noEmoji: x,
|
|
11
|
+
readOnlyCard: b,
|
|
12
|
+
lead: d,
|
|
13
|
+
emojiSlot: g,
|
|
14
|
+
emoji: t,
|
|
15
|
+
text: v,
|
|
16
|
+
dropdown: z,
|
|
17
|
+
fieldEmoji: l,
|
|
18
|
+
menuOption: p,
|
|
19
|
+
pickerOption: m,
|
|
20
|
+
readOnly: c,
|
|
21
|
+
readOnlyAnswer: s,
|
|
22
|
+
noAnswer: O,
|
|
23
|
+
showAll: j
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
y as default
|
|
27
|
+
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as R } from "../../../../helpers/cn.js";
|
|
2
2
|
import e from "./StyledRadio.module.js";
|
|
3
3
|
import { useRadioGroupContext as S } from "./RadioGroupContext.js";
|
|
4
4
|
import { forwardRef as j, useCallback as F, useRef as K } from "react";
|
|
5
|
-
import { Fragment as _, jsx as r, jsxs as
|
|
6
|
-
var $ = j(({ value: o, dataTest: c, className:
|
|
7
|
-
const n = S(), d = n ? n.value === o : !!v, s =
|
|
5
|
+
import { Fragment as _, jsx as r, jsxs as k } from "react/jsx-runtime";
|
|
6
|
+
var $ = j(({ value: o, dataTest: c, className: g, size: p = "medium", error: C, disabled: b, readOnly: t, checked: v, onChange: N, onKeyDown: w, decorative: m, ...u }, y) => {
|
|
7
|
+
const n = S(), d = n ? n.value === o : !!v, s = b ?? n?.disabled ?? !1, f = R(e.RadioWrapper, !m && e.RadioHover, p === "small" && e["size-small"], g, C && e.Error, t && e.ReadOnly), D = R(e.Radio, p === "small" && e["size-small"]), l = K(null), x = F((a) => {
|
|
8
8
|
if (a.stopPropagation(), !l.current) return;
|
|
9
9
|
const i = document.createElement("span");
|
|
10
10
|
e.RadioRipple && (i.className = e.RadioRipple), i.addEventListener("animationend", () => i.remove(), { once: !0 }), l.current.appendChild(i);
|
|
11
11
|
}, []), E = (a) => {
|
|
12
|
-
t || (n && n.onSelect(o ?? null),
|
|
12
|
+
t || (n && n.onSelect(o ?? null), N?.(a, a.target.checked));
|
|
13
13
|
}, P = (a) => {
|
|
14
|
-
|
|
15
|
-
},
|
|
14
|
+
w?.(a), !(a.defaultPrevented || a.key !== "Enter" || t) && (a.preventDefault(), a.currentTarget.click());
|
|
15
|
+
}, h = /* @__PURE__ */ k(_, { children: [/* @__PURE__ */ r("span", {
|
|
16
16
|
className: e.RadioRippleContainer,
|
|
17
17
|
ref: l
|
|
18
18
|
}), /* @__PURE__ */ r("span", {
|
|
19
19
|
className: D,
|
|
20
20
|
children: /* @__PURE__ */ r("span", { className: e.Indicator })
|
|
21
21
|
})] });
|
|
22
|
-
return
|
|
22
|
+
return m ? /* @__PURE__ */ r("span", {
|
|
23
23
|
"aria-hidden": "true",
|
|
24
|
-
className:
|
|
24
|
+
className: f,
|
|
25
25
|
"data-testid": c,
|
|
26
26
|
"data-checked": d ? "" : void 0,
|
|
27
27
|
"data-unchecked": d ? void 0 : "",
|
|
28
28
|
"data-disabled": s ? "" : void 0,
|
|
29
|
-
children:
|
|
30
|
-
}) : /* @__PURE__ */
|
|
31
|
-
className:
|
|
29
|
+
children: h
|
|
30
|
+
}) : /* @__PURE__ */ k("label", {
|
|
31
|
+
className: f,
|
|
32
32
|
"data-testid": c,
|
|
33
33
|
onPointerDown: x,
|
|
34
34
|
"data-checked": d ? "" : void 0,
|
|
35
35
|
"data-unchecked": d ? void 0 : "",
|
|
36
36
|
"data-disabled": s ? "" : void 0,
|
|
37
37
|
children: [/* @__PURE__ */ r("input", {
|
|
38
|
-
...
|
|
38
|
+
...u,
|
|
39
39
|
ref: y,
|
|
40
40
|
type: "radio",
|
|
41
41
|
className: "sr-only",
|
|
42
|
-
name: n?.name ??
|
|
42
|
+
name: n?.name ?? u.name,
|
|
43
43
|
value: o == null ? void 0 : String(o),
|
|
44
44
|
checked: d,
|
|
45
45
|
disabled: s,
|
|
46
46
|
onChange: E,
|
|
47
47
|
onKeyDown: P
|
|
48
|
-
}),
|
|
48
|
+
}), h]
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
export {
|