@pie-lib/correct-answer-toggle 5.0.6-next.20261015154938 → 5.0.6-next.20261018193205
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/i18n/ar.d.ts +5 -0
- package/dist/i18n/ar.js +7 -0
- package/dist/i18n/cy.d.ts +5 -0
- package/dist/i18n/cy.js +7 -0
- package/dist/i18n/en-AU.d.ts +5 -0
- package/dist/i18n/en-AU.js +7 -0
- package/dist/i18n/en-GB.d.ts +5 -0
- package/dist/i18n/en-GB.js +7 -0
- package/dist/i18n/en-US.d.ts +6 -0
- package/dist/i18n/en-US.js +7 -0
- package/dist/i18n/es.d.ts +5 -0
- package/dist/i18n/es.js +7 -0
- package/dist/i18n/fr.d.ts +5 -0
- package/dist/i18n/fr.js +7 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.js +59 -0
- package/dist/i18n/ja.d.ts +5 -0
- package/dist/i18n/ja.js +7 -0
- package/dist/i18n/ko.d.ts +5 -0
- package/dist/i18n/ko.js +7 -0
- package/dist/i18n/pt.d.ts +5 -0
- package/dist/i18n/pt.js +7 -0
- package/dist/i18n/sv.d.ts +5 -0
- package/dist/i18n/sv.js +7 -0
- package/dist/i18n/th-TH.d.ts +5 -0
- package/dist/i18n/th-TH.js +7 -0
- package/dist/i18n/zh.d.ts +5 -0
- package/dist/i18n/zh.js +7 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +49 -58
- package/package.json +3 -3
package/dist/i18n/ar.js
ADDED
package/dist/i18n/cy.js
ADDED
package/dist/i18n/es.js
ADDED
package/dist/i18n/fr.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import e from "./en-US.js";
|
|
2
|
+
import { defineCatalogs as t } from "@pie-element/shared-i18n";
|
|
3
|
+
//#region src/i18n/index.ts
|
|
4
|
+
var n = t({
|
|
5
|
+
packageName: "@pie-lib/correct-answer-toggle",
|
|
6
|
+
source: e,
|
|
7
|
+
loaders: {
|
|
8
|
+
es: () => import(
|
|
9
|
+
/* webpackMode: "eager" */
|
|
10
|
+
"./es.js"
|
|
11
|
+
),
|
|
12
|
+
"th-TH": () => import(
|
|
13
|
+
/* webpackMode: "eager" */
|
|
14
|
+
"./th-TH.js"
|
|
15
|
+
),
|
|
16
|
+
"en-GB": () => import(
|
|
17
|
+
/* webpackMode: "eager" */
|
|
18
|
+
"./en-GB.js"
|
|
19
|
+
),
|
|
20
|
+
"en-AU": () => import(
|
|
21
|
+
/* webpackMode: "eager" */
|
|
22
|
+
"./en-AU.js"
|
|
23
|
+
),
|
|
24
|
+
fr: () => import(
|
|
25
|
+
/* webpackMode: "eager" */
|
|
26
|
+
"./fr.js"
|
|
27
|
+
),
|
|
28
|
+
ar: () => import(
|
|
29
|
+
/* webpackMode: "eager" */
|
|
30
|
+
"./ar.js"
|
|
31
|
+
),
|
|
32
|
+
pt: () => import(
|
|
33
|
+
/* webpackMode: "eager" */
|
|
34
|
+
"./pt.js"
|
|
35
|
+
),
|
|
36
|
+
ko: () => import(
|
|
37
|
+
/* webpackMode: "eager" */
|
|
38
|
+
"./ko.js"
|
|
39
|
+
),
|
|
40
|
+
ja: () => import(
|
|
41
|
+
/* webpackMode: "eager" */
|
|
42
|
+
"./ja.js"
|
|
43
|
+
),
|
|
44
|
+
zh: () => import(
|
|
45
|
+
/* webpackMode: "eager" */
|
|
46
|
+
"./zh.js"
|
|
47
|
+
),
|
|
48
|
+
cy: () => import(
|
|
49
|
+
/* webpackMode: "eager" */
|
|
50
|
+
"./cy.js"
|
|
51
|
+
),
|
|
52
|
+
sv: () => import(
|
|
53
|
+
/* webpackMode: "eager" */
|
|
54
|
+
"./sv.js"
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
export { n as catalogs };
|
package/dist/i18n/ja.js
ADDED
package/dist/i18n/ko.js
ADDED
package/dist/i18n/pt.js
ADDED
package/dist/i18n/sv.js
ADDED
package/dist/i18n/zh.js
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -8,18 +8,21 @@ export declare class CorrectAnswerToggle extends React.Component {
|
|
|
8
8
|
onToggle: PropTypes.Requireable<(...args: any[]) => any>;
|
|
9
9
|
toggled: PropTypes.Requireable<boolean>;
|
|
10
10
|
show: PropTypes.Requireable<boolean>;
|
|
11
|
+
/** Overrides the localized label of the toggled state. */
|
|
11
12
|
hideMessage: PropTypes.Requireable<string>;
|
|
13
|
+
/** Overrides the localized label of the untoggled state. */
|
|
12
14
|
showMessage: PropTypes.Requireable<string>;
|
|
13
15
|
className: PropTypes.Requireable<string>;
|
|
16
|
+
/** The item language, which the default labels follow. */
|
|
14
17
|
language: PropTypes.Requireable<string>;
|
|
15
18
|
};
|
|
16
19
|
static defaultProps: {
|
|
17
|
-
showMessage: string;
|
|
18
|
-
hideMessage: string;
|
|
19
20
|
show: boolean;
|
|
20
21
|
toggled: boolean;
|
|
21
22
|
};
|
|
22
23
|
constructor(props: any);
|
|
24
|
+
/** Re-renders once the item language's catalog lands, for an element that did not preload it. */
|
|
25
|
+
relabel: () => void;
|
|
23
26
|
onClick(): void;
|
|
24
27
|
onTouch(event: any): void;
|
|
25
28
|
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import e from "./expander.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import l from "react";
|
|
9
|
-
import u from "
|
|
10
|
-
import d from "
|
|
2
|
+
import { catalogs as t } from "./i18n/index.js";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import { CSSTransition as r } from "react-transition-group";
|
|
5
|
+
import { CorrectResponse as i } from "@pie-lib/icons";
|
|
6
|
+
import * as a from "@pie-lib/render-ui";
|
|
7
|
+
import { Readable as o, color as s } from "@pie-lib/render-ui";
|
|
8
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
import u from "react";
|
|
10
|
+
import d from "prop-types";
|
|
11
11
|
//#region src/index.tsx
|
|
12
12
|
function f(e) {
|
|
13
13
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
@@ -15,17 +15,17 @@ function f(e) {
|
|
|
15
15
|
function p(e, t) {
|
|
16
16
|
return !e || f(e) ? e : f(e.default) ? e.default : t && f(e[t]) ? e[t] : t && f(e[t]?.default) ? e[t].default : e;
|
|
17
17
|
}
|
|
18
|
-
var m =
|
|
18
|
+
var m = a, h = m.default, g = h && typeof h == "object" ? h : m, _ = p(o, "Readable") || p(g.Readable, "Readable"), v = {
|
|
19
19
|
WebkitTouchCallout: "none",
|
|
20
20
|
WebkitUserSelect: "none",
|
|
21
21
|
KhtmlUserSelect: "none",
|
|
22
22
|
MozUserSelect: "none",
|
|
23
23
|
msUserSelect: "none",
|
|
24
24
|
userSelect: "none"
|
|
25
|
-
},
|
|
25
|
+
}, y = n("div")(() => ({
|
|
26
26
|
width: "100%",
|
|
27
27
|
cursor: "pointer"
|
|
28
|
-
})),
|
|
28
|
+
})), b = n("button")(() => ({
|
|
29
29
|
margin: "0 auto",
|
|
30
30
|
textAlign: "center",
|
|
31
31
|
display: "flex",
|
|
@@ -38,18 +38,18 @@ var m = i, h = m.default, g = h && typeof h == "object" ? h : m, _ = p(a, "Reada
|
|
|
38
38
|
font: "inherit",
|
|
39
39
|
cursor: "pointer",
|
|
40
40
|
"&:focus-visible": {
|
|
41
|
-
outline: `2px solid ${
|
|
41
|
+
outline: `2px solid ${s.buttonFocusOutline()}`,
|
|
42
42
|
outlineOffset: "-2px"
|
|
43
43
|
}
|
|
44
|
-
})),
|
|
44
|
+
})), x = n("div")(() => ({
|
|
45
45
|
width: "fit-content",
|
|
46
46
|
minWidth: "140px",
|
|
47
47
|
alignSelf: "center",
|
|
48
48
|
verticalAlign: "middle",
|
|
49
|
-
color: `var(--correct-answer-toggle-label-color, ${
|
|
49
|
+
color: `var(--correct-answer-toggle-label-color, ${s.text()})`,
|
|
50
50
|
fontWeight: "normal",
|
|
51
|
-
...
|
|
52
|
-
})),
|
|
51
|
+
...v
|
|
52
|
+
})), S = n("div")(() => ({
|
|
53
53
|
position: "absolute",
|
|
54
54
|
width: "25px",
|
|
55
55
|
"&.enter": { opacity: "0" },
|
|
@@ -62,34 +62,29 @@ var m = i, h = m.default, g = h && typeof h == "object" ? h : m, _ = p(a, "Reada
|
|
|
62
62
|
opacity: "0",
|
|
63
63
|
transition: "opacity 0.3s ease-in"
|
|
64
64
|
}
|
|
65
|
-
})),
|
|
65
|
+
})), C = n("div")(() => ({
|
|
66
66
|
width: "25px",
|
|
67
67
|
marginRight: "5px",
|
|
68
68
|
display: "flex",
|
|
69
69
|
alignItems: "center"
|
|
70
|
-
})),
|
|
70
|
+
})), w = class extends u.Component {
|
|
71
71
|
static propTypes = {
|
|
72
|
-
onToggle:
|
|
73
|
-
toggled:
|
|
74
|
-
show:
|
|
75
|
-
hideMessage:
|
|
76
|
-
showMessage:
|
|
77
|
-
className:
|
|
78
|
-
language:
|
|
72
|
+
onToggle: d.func,
|
|
73
|
+
toggled: d.bool,
|
|
74
|
+
show: d.bool,
|
|
75
|
+
hideMessage: d.string,
|
|
76
|
+
showMessage: d.string,
|
|
77
|
+
className: d.string,
|
|
78
|
+
language: d.string
|
|
79
79
|
};
|
|
80
80
|
static defaultProps = {
|
|
81
|
-
showMessage: "Show correct answer",
|
|
82
|
-
hideMessage: "Hide correct answer",
|
|
83
81
|
show: !1,
|
|
84
82
|
toggled: !1
|
|
85
83
|
};
|
|
86
84
|
constructor(e) {
|
|
87
|
-
super(e), this.state = { show: e.show }, this.openIconRef =
|
|
88
|
-
...t.defaultProps,
|
|
89
|
-
showMessage: v.t("common:showCorrectAnswer", { lng: e.language }),
|
|
90
|
-
hideMessage: v.t("common:hideCorrectAnswer", { lng: e.language })
|
|
91
|
-
};
|
|
85
|
+
super(e), this.state = { show: e.show }, this.openIconRef = u.createRef(), this.closedIconRef = u.createRef();
|
|
92
86
|
}
|
|
87
|
+
relabel = () => this.forceUpdate();
|
|
93
88
|
onClick() {
|
|
94
89
|
this.props.onToggle(!this.props.toggled);
|
|
95
90
|
}
|
|
@@ -97,58 +92,54 @@ var m = i, h = m.default, g = h && typeof h == "object" ? h : m, _ = p(a, "Reada
|
|
|
97
92
|
e.preventDefault(), this.props.onToggle(!this.props.toggled);
|
|
98
93
|
}
|
|
99
94
|
UNSAFE_componentWillReceiveProps(e) {
|
|
100
|
-
this.setState({ show: e.show })
|
|
101
|
-
...t.defaultProps,
|
|
102
|
-
showMessage: v.t("common:showCorrectAnswer", { lng: e.language }),
|
|
103
|
-
hideMessage: v.t("common:hideCorrectAnswer", { lng: e.language })
|
|
104
|
-
});
|
|
95
|
+
this.setState({ show: e.show });
|
|
105
96
|
}
|
|
106
97
|
render() {
|
|
107
|
-
let { className:
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
className:
|
|
110
|
-
children: /* @__PURE__ */
|
|
98
|
+
let { className: n, toggled: a, language: o } = this.props, s = t.forLocale(o, this.relabel), u = this.props.hideMessage ?? s.t("hideCorrectAnswer"), d = this.props.showMessage ?? s.t("showCorrectAnswer");
|
|
99
|
+
return /* @__PURE__ */ c(y, {
|
|
100
|
+
className: n,
|
|
101
|
+
children: /* @__PURE__ */ c(e, {
|
|
111
102
|
show: this.state.show,
|
|
112
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ l(b, {
|
|
113
104
|
type: "button",
|
|
114
|
-
"aria-pressed": !!
|
|
105
|
+
"aria-pressed": !!a,
|
|
115
106
|
onClick: this.onClick.bind(this),
|
|
116
107
|
onTouchEnd: this.onTouch.bind(this),
|
|
117
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ l(C, { children: [/* @__PURE__ */ c(r, {
|
|
118
109
|
nodeRef: this.openIconRef,
|
|
119
110
|
timeout: 400,
|
|
120
|
-
in:
|
|
121
|
-
exit: !
|
|
111
|
+
in: a,
|
|
112
|
+
exit: !a,
|
|
122
113
|
classNames: {
|
|
123
114
|
enter: "enter",
|
|
124
115
|
enterActive: "enter-active",
|
|
125
116
|
exit: "exit",
|
|
126
117
|
exitActive: "exit-active"
|
|
127
118
|
},
|
|
128
|
-
children: /* @__PURE__ */
|
|
119
|
+
children: /* @__PURE__ */ c(S, {
|
|
129
120
|
ref: this.openIconRef,
|
|
130
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ c(i, { open: a }, "correct-open")
|
|
131
122
|
})
|
|
132
|
-
}), /* @__PURE__ */
|
|
123
|
+
}), /* @__PURE__ */ c(r, {
|
|
133
124
|
nodeRef: this.closedIconRef,
|
|
134
125
|
timeout: 5e3,
|
|
135
|
-
in: !
|
|
136
|
-
exit:
|
|
126
|
+
in: !a,
|
|
127
|
+
exit: a,
|
|
137
128
|
classNames: {
|
|
138
129
|
enter: "enter",
|
|
139
130
|
enterActive: "enter-active",
|
|
140
131
|
exit: "exit",
|
|
141
132
|
exitActive: "exit-active"
|
|
142
133
|
},
|
|
143
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ c(S, {
|
|
144
135
|
ref: this.closedIconRef,
|
|
145
|
-
children: /* @__PURE__ */
|
|
136
|
+
children: /* @__PURE__ */ c(i, { open: a }, "correct-closed")
|
|
146
137
|
})
|
|
147
|
-
})] }), /* @__PURE__ */
|
|
138
|
+
})] }), /* @__PURE__ */ c(_, {
|
|
148
139
|
false: !0,
|
|
149
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ c(x, {
|
|
150
141
|
"aria-hidden": !this.state.show,
|
|
151
|
-
children:
|
|
142
|
+
children: a ? u : d
|
|
152
143
|
})
|
|
153
144
|
})]
|
|
154
145
|
})
|
|
@@ -157,4 +148,4 @@ var m = i, h = m.default, g = h && typeof h == "object" ? h : m, _ = p(a, "Reada
|
|
|
157
148
|
}
|
|
158
149
|
};
|
|
159
150
|
//#endregion
|
|
160
|
-
export {
|
|
151
|
+
export { w as CorrectAnswerToggle, w as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/correct-answer-toggle",
|
|
3
|
-
"version": "5.0.6-next.
|
|
3
|
+
"version": "5.0.6-next.20261018193205",
|
|
4
4
|
"description": "A react based toggle component",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@mui/icons-material": "^7.3.4",
|
|
14
14
|
"@mui/material": "^7.3.4",
|
|
15
15
|
"@pie-lib/icons": "5.0.2-next.20261006160832",
|
|
16
|
-
"@pie-lib/render-ui": "8.0.6-next.
|
|
17
|
-
"@pie-
|
|
16
|
+
"@pie-lib/render-ui": "8.0.6-next.20261018193205",
|
|
17
|
+
"@pie-element/shared-i18n": "0.1.1-next.20261018193205",
|
|
18
18
|
"prop-types": "^15.6.2",
|
|
19
19
|
"react-transition-group": "^4.4.5",
|
|
20
20
|
"@pie-element/shared-lodash": "0.1.3-next.20261012213240"
|