@1024pix/epreuves-components 0.1.0 → 0.1.1

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.
@@ -1,4 +1,4 @@
1
- import { d as i, r as l, c as n, o as a, n as p, a as t, b as c, F as u, e as f, f as m, _ as g, g as _ } from "../_plugin-vue_export-helper-CG_vnhyz.js";
1
+ import { d as i, r as l, c as n, o as a, n as p, a as t, b as c, F as u, e as f, f as m, _ as g, g as _ } from "../_plugin-vue_export-helper-Covkti4z.js";
2
2
  const v = { class: "card-inner" }, y = /* @__PURE__ */ i({
3
3
  __name: "CarteARetourner",
4
4
  props: {
@@ -0,0 +1,59 @@
1
+ import { d as u, h as _, c as t, o as s, n as y, i as m, a as d, j as l, t as c, F as p, e as f, f as h, _ as x, g as k } from "../_plugin-vue_export-helper-Covkti4z.js";
2
+ const b = ["part"], v = ["part"], w = { key: 0 }, C = /* @__PURE__ */ u({
3
+ __name: "Message",
4
+ props: {
5
+ displaySender: { type: Boolean, default: !0 },
6
+ message: {}
7
+ },
8
+ setup(i) {
9
+ const g = _(() => i.message.content.split(`
10
+ `));
11
+ return (e, n) => (s(), t("div", {
12
+ class: y(["message", `message--${e.message.direction}`])
13
+ }, [
14
+ e.displaySender ? (s(), t("p", {
15
+ key: 0,
16
+ class: "message__sender",
17
+ part: `sender ${e.message.direction}`
18
+ }, [
19
+ n[0] || (n[0] = d("span", { class: "sr-only" }, "Message de ", -1)),
20
+ l(c(e.message.userName), 1)
21
+ ], 8, b)) : m("", !0),
22
+ d("p", {
23
+ class: "message__content",
24
+ part: `message ${e.message.direction}`
25
+ }, [
26
+ (s(!0), t(p, null, f(g.value, (a, o) => (s(), t(p, { key: o }, [
27
+ o > 0 ? (s(), t("br", w)) : m("", !0),
28
+ l(" " + c(a), 1)
29
+ ], 64))), 128))
30
+ ], 8, v)
31
+ ], 2));
32
+ }
33
+ }), N = { part: "conversation" }, $ = { class: "sr-only" }, B = /* @__PURE__ */ u({
34
+ __name: "MessageConversation.ce",
35
+ props: {
36
+ props: { type: Object }
37
+ },
38
+ setup(i) {
39
+ const g = _(
40
+ () => i.props.messages.reduce(
41
+ (e, n) => {
42
+ var r;
43
+ const a = (r = e.at(-1)) == null ? void 0 : r.message, o = !a || n.direction !== a.direction || n.userName !== a.userName;
44
+ return [...e, { message: n, displaySender: o }];
45
+ },
46
+ []
47
+ )
48
+ );
49
+ return (e, n) => (s(), t("figure", N, [
50
+ d("figcaption", $, c(e.props.title ?? "Conversation par messages"), 1),
51
+ (s(!0), t(p, null, f(g.value, ({ message: a, displaySender: o }, r) => (s(), h(C, {
52
+ message: a,
53
+ "display-sender": o,
54
+ key: r
55
+ }, null, 8, ["message", "display-sender"]))), 128))
56
+ ]));
57
+ }
58
+ }), M = "figure{background-color:#fff;border-radius:16px;display:flex;flex-direction:column;gap:8px;margin:0;padding:16px}.message{max-width:80%}.message--incoming{align-self:start}.message--incoming .message__sender{padding-left:10px}.message--incoming .message__content{background-color:#e8e8e8}.message--outgoing{align-self:end}.message--outgoing .message__sender{padding-right:10px;text-align:right}.message--outgoing .message__content{background-color:#d1eaff}.message__sender{color:#444;font-size:.8rem;font-weight:700;margin:0}.message__content{border-radius:16px;margin:0;padding:10px 14px}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}", S = /* @__PURE__ */ x(B, [["styles", [M]]]);
59
+ window.customElements.define("message-conversation", k(S));
@@ -1,5 +1,5 @@
1
- import { d as b, r as _, w as y, c as h, o as r, h as g, i as p, n as v, a as k, m as q, t as w, j as m, s as $, F as P, e as B, f as N, _ as j, g as z } from "../_plugin-vue_export-helper-CG_vnhyz.js";
2
- function L(o, n = E) {
1
+ import { d as b, r as _, w as y, c as h, o as r, k as g, l as p, n as v, a as k, m as q, t as w, h as m, s as $, F as P, e as B, f as N, _ as z, g as L } from "../_plugin-vue_export-helper-Covkti4z.js";
2
+ function j(o, n = E) {
3
3
  const i = [...o];
4
4
  for (let a = i.length - 1; a > 0; a--) {
5
5
  const e = n() % (a + 1);
@@ -65,7 +65,7 @@ const M = ["aria-checked", "tabindex"], Q = { key: 0 }, S = /* @__PURE__ */ b({
65
65
  },
66
66
  emits: ["answer"],
67
67
  setup(o, { emit: n }) {
68
- const i = n, a = m(() => o.props.maxChoicesPerLine ?? 5), e = m(() => o.props.hideChoicesName ? "sr-only" : ""), s = m(() => o.props.imageChoicesSize ?? "icon"), c = m(() => o.props.orderChoices ? o.props.choices : L(o.props.choices)), t = $(), C = m(() => t.value ?? c.value[0]);
68
+ const i = n, a = m(() => o.props.maxChoicesPerLine ?? 5), e = m(() => o.props.hideChoicesName ? "sr-only" : ""), s = m(() => o.props.imageChoicesSize ?? "icon"), c = m(() => o.props.orderChoices ? o.props.choices : j(o.props.choices)), t = $(), C = m(() => t.value ?? c.value[0]);
69
69
  function d(l) {
70
70
  l === -1 ? t.value = c.value[c.value.length - 1] : l === c.value.length ? t.value = c.value[0] : t.value = c.value[l], i("answer", t.value.response ?? t.value.name);
71
71
  }
@@ -88,5 +88,5 @@ const M = ["aria-checked", "tabindex"], Q = { key: 0 }, S = /* @__PURE__ */ b({
88
88
  }, null, 8, ["choice", "max-choices-per-line", "name-class", "image-class", "checked", "focusable", "onCheck", "onCheckNext", "onCheckPrevious"]))), 128))
89
89
  ], 8, U));
90
90
  }
91
- }), I = '*{box-sizing:border-box}ul,li{padding:0;margin:0}li{list-style:none}.qcu-image{display:flex;width:100%;flex-wrap:wrap;justify-content:space-around;font-size:110%;font-family:Open Sans,Arial,sans-serif}.qcu-image__choice{display:flex;position:relative;flex-direction:column;align-items:center;justify-content:center;margin:1em;border:solid 2px #c1c7d0;border-radius:10px;background:#fff;width:calc(20% - 2em);min-width:120px}.qcu-image__choice--max4{width:calc(25% - 2em);min-width:175px}.qcu-image__choice--max3{width:calc(33% - 2em)}.qcu-image__choice--max2{width:calc(50% - 2em);min-width:300px}.qcu-image__choice--max1{width:calc(100% - 4em);min-width:300px}.qcu-image__choice:hover{cursor:pointer;box-shadow:0 3px 10px #0000001a;transform:scale(1.04);transition:transform ease-in .1s}.qcu-image__choice:focus{outline:none;box-shadow:5px 5px #ffbe00,-5px 5px #ffbe00,5px -5px #ffbe00,-5px -5px #ffbe00}.qcu-image__choice[aria-checked=true]{border-color:#3d68ff}.qcu-image__choice[aria-checked=true]:after{content:"";position:absolute;width:100%;height:100%;background:#3d68ff4d;border-radius:10px;z-index:3}.qcu-image__choice figure{width:100%;padding:0 10px;margin:3px;text-align:center}.qcu-image__choice figure img{max-width:100%;height:auto}.qcu-image__choice figure img.icon{max-height:100px;width:auto}.qcu-image__choice figure img.medium{max-width:50%;height:auto}.qcu-image__choice figure figcaption{margin:1ex}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}', K = /* @__PURE__ */ j(F, [["styles", [I]]]);
92
- window.customElements.define("qcu-image", z(K));
91
+ }), I = '*{box-sizing:border-box}ul,li{padding:0;margin:0}li{list-style:none}.qcu-image{display:flex;width:100%;flex-wrap:wrap;justify-content:space-around;font-size:110%;font-family:Open Sans,Arial,sans-serif}.qcu-image__choice{display:flex;position:relative;flex-direction:column;align-items:center;justify-content:center;margin:1em;border:solid 2px #c1c7d0;border-radius:10px;background:#fff;width:calc(20% - 2em);min-width:120px}.qcu-image__choice--max4{width:calc(25% - 2em);min-width:175px}.qcu-image__choice--max3{width:calc(33% - 2em)}.qcu-image__choice--max2{width:calc(50% - 2em);min-width:300px}.qcu-image__choice--max1{width:calc(100% - 4em);min-width:300px}.qcu-image__choice:hover{cursor:pointer;box-shadow:0 3px 10px #0000001a;transform:scale(1.04);transition:transform ease-in .1s}.qcu-image__choice:focus{outline:none;box-shadow:5px 5px #ffbe00,-5px 5px #ffbe00,5px -5px #ffbe00,-5px -5px #ffbe00}.qcu-image__choice[aria-checked=true]{border-color:#3d68ff}.qcu-image__choice[aria-checked=true]:after{content:"";position:absolute;width:100%;height:100%;background:#3d68ff4d;border-radius:10px;z-index:3}.qcu-image__choice figure{width:100%;padding:0 10px;margin:3px;text-align:center}.qcu-image__choice figure img{max-width:100%;height:auto}.qcu-image__choice figure img.icon{max-height:100px;width:auto}.qcu-image__choice figure img.medium{max-width:50%;height:auto}.qcu-image__choice figure figcaption{margin:1ex}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}', K = /* @__PURE__ */ z(F, [["styles", [I]]]);
92
+ window.customElements.define("qcu-image", L(K));
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
+ import "./components/message-conversation.js";
1
2
  import "./components/qcu-image.js";
2
3
  import "./components/cartes-a-retourner.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/epreuves-components",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A collection of interactive components to be used in Pix challenges or modules",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",