@selectwin/kit 0.1.257 → 0.1.258

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,72 +1,94 @@
1
- import { SelectBadge as e } from "./SelectBadge.js";
2
- import { createContext as t, useContext as n, useState as r } from "react";
3
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
1
+ import { LockIcon as e } from "./icons.js";
2
+ import { useSelectMessages as t } from "./SelectLocale.js";
3
+ import { SelectBadge as n } from "./SelectBadge.js";
4
+ import { SelectScrollArea as r } from "./SelectScrollArea.js";
5
+ import { createContext as i, useContext as a, useState as o } from "react";
6
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
4
7
  //#region src/SelectKanban.tsx
5
- var o = t(null), s = t("");
6
- function c({ columns: t, onMove: n, className: c, "aria-label": l }) {
7
- let [u, d] = r(null), [f, p] = r(null), m = (e) => !!(u && e.droppable && e.id !== u.from);
8
- return /* @__PURE__ */ i(o.Provider, {
8
+ var u = i(null), d = i({
9
+ id: "",
10
+ locked: !1
11
+ });
12
+ function f({ columns: i, onMove: a, fill: f = !1, className: p, "aria-label": m }) {
13
+ let h = t(), [g, _] = o(null), [v, y] = o(null), b = (e) => !!(g && e.droppable && !e.locked && e.id !== g.from);
14
+ return /* @__PURE__ */ c(u.Provider, {
9
15
  value: {
10
- dragging: u,
11
- setDragging: d,
12
- movable: !!n
16
+ dragging: g,
17
+ setDragging: _,
18
+ movable: !!a
13
19
  },
14
- children: /* @__PURE__ */ i("div", {
15
- className: `select-kanban${u ? " is-dragging" : ""}${c ? " " + c : ""}`,
20
+ children: /* @__PURE__ */ c(r, {
21
+ axis: "x",
22
+ className: `select-kanban${f ? " select-kanban--fill" : ""}${g ? " is-dragging" : ""}${p ? " " + p : ""}`,
16
23
  role: "list",
17
- "aria-label": l,
18
- children: t.map((t) => {
19
- let r = m(t), o = !!u && !r && t.id !== (u == null ? void 0 : u.from), c = Array.isArray(t.children) ? t.children.some(Boolean) : !!t.children;
20
- return /* @__PURE__ */ a("section", {
24
+ "aria-label": m,
25
+ children: i.map((t) => {
26
+ let i = b(t), o = !!g && !i && t.id !== (g == null ? void 0 : g.from), u = Array.isArray(t.children) ? t.children.some(Boolean) : !!t.children, p = !!t.locked, m = u ? t.children : t.empty ? /* @__PURE__ */ c("div", {
27
+ className: "select-kanban__empty",
28
+ children: t.empty
29
+ }) : null;
30
+ return /* @__PURE__ */ l("section", {
21
31
  role: "listitem",
22
32
  "aria-label": typeof t.title == "string" ? t.title : void 0,
23
- className: `select-kanban__col${r ? " select-kanban__col--target" : ""}${r && f === t.id ? " select-kanban__col--over" : ""}${o ? " select-kanban__col--blocked" : ""}`,
33
+ className: `select-kanban__col${p ? " select-kanban__col--locked" : ""}${i ? " select-kanban__col--target" : ""}${i && v === t.id ? " select-kanban__col--over" : ""}${o ? " select-kanban__col--blocked" : ""}`,
24
34
  onDragOver: (e) => {
25
- r && (e.preventDefault(), e.dataTransfer.dropEffect = "move", f !== t.id && p(t.id));
35
+ i && (e.preventDefault(), e.dataTransfer.dropEffect = "move", v !== t.id && y(t.id));
26
36
  },
27
37
  onDragLeave: (e) => {
28
- e.currentTarget.contains(e.relatedTarget) || f === t.id && p(null);
38
+ e.currentTarget.contains(e.relatedTarget) || v === t.id && y(null);
29
39
  },
30
40
  onDrop: (e) => {
31
- r && u && (e.preventDefault(), n == null || n(u.cardId, u.from, t.id), d(null), p(null));
41
+ i && g && (e.preventDefault(), a == null || a(g.cardId, g.from, t.id), _(null), y(null));
32
42
  },
33
43
  children: [
34
- /* @__PURE__ */ a("header", {
44
+ /* @__PURE__ */ l("header", {
35
45
  className: "select-kanban__colhead",
36
- children: [/* @__PURE__ */ a("h3", {
46
+ children: [/* @__PURE__ */ l("h3", {
37
47
  className: "select-kanban__coltitle",
38
48
  children: [
39
- /* @__PURE__ */ i("span", {
49
+ /* @__PURE__ */ c("span", {
40
50
  className: `select-kanban__dot select-kanban__dot--${t.tone ?? "neutral"}`,
41
51
  "aria-hidden": "true"
42
52
  }),
43
- /* @__PURE__ */ i("span", {
53
+ /* @__PURE__ */ c("span", {
44
54
  className: "select-kanban__colname",
45
55
  children: t.title
46
56
  }),
47
- typeof t.count == "number" ? /* @__PURE__ */ i(e, {
57
+ p ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("span", {
58
+ className: "select-kanban__lock",
59
+ "aria-hidden": "true",
60
+ children: /* @__PURE__ */ c(e, {})
61
+ }), /* @__PURE__ */ l("span", {
62
+ className: "select-visually-hidden",
63
+ children: [
64
+ "(",
65
+ t.lockedLabel ?? h.lock.label,
66
+ ")"
67
+ ]
68
+ })] }) : null,
69
+ typeof t.count == "number" ? /* @__PURE__ */ c(n, {
48
70
  size: "sm",
49
71
  tone: "neutral",
50
72
  children: t.count
51
73
  }) : null
52
74
  ]
53
- }), t.description ? /* @__PURE__ */ i("p", {
75
+ }), t.description ? /* @__PURE__ */ c("p", {
54
76
  className: "select-kanban__coldesc",
55
77
  children: t.description
56
78
  }) : null]
57
79
  }),
58
- /* @__PURE__ */ i(s.Provider, {
59
- value: t.id,
60
- children: /* @__PURE__ */ i("div", {
80
+ /* @__PURE__ */ c(d.Provider, {
81
+ value: {
82
+ id: t.id,
83
+ locked: p
84
+ },
85
+ children: c(f ? r : "div", {
61
86
  className: "select-kanban__cards",
62
87
  role: "list",
63
- children: c ? t.children : t.empty ? /* @__PURE__ */ i("div", {
64
- className: "select-kanban__empty",
65
- children: t.empty
66
- }) : null
88
+ children: m
67
89
  })
68
90
  }),
69
- t.footer ? /* @__PURE__ */ i("div", {
91
+ t.footer ? /* @__PURE__ */ c("div", {
70
92
  className: "select-kanban__foot",
71
93
  children: t.footer
72
94
  }) : null
@@ -76,49 +98,49 @@ function c({ columns: t, onMove: n, className: c, "aria-label": l }) {
76
98
  })
77
99
  });
78
100
  }
79
- function l({ id: e, title: t, subtitle: r, meta: c, actions: l, onOpen: u, locked: d = !1 }) {
101
+ function p({ id: e, title: t, subtitle: n, meta: r, actions: i, onOpen: o, locked: s = !1 }) {
80
102
  var f;
81
- let p = n(o), m = n(s), h = !!(p != null && p.movable) && !d, g = (p == null || (f = p.dragging) == null ? void 0 : f.cardId) === e;
82
- return /* @__PURE__ */ a("article", {
103
+ let p = a(u), m = a(d), h = !!(p != null && p.movable) && !s && !m.locked, g = (p == null || (f = p.dragging) == null ? void 0 : f.cardId) === e;
104
+ return /* @__PURE__ */ l("article", {
83
105
  role: "listitem",
84
- className: `select-kanban__card${u ? " select-kanban__card--open" : ""}${h ? " select-kanban__card--draggable" : ""}${g ? " is-dragging" : ""}`,
106
+ className: `select-kanban__card${o ? " select-kanban__card--open" : ""}${h ? " select-kanban__card--draggable" : ""}${g ? " is-dragging" : ""}`,
85
107
  draggable: h || void 0,
86
108
  onDragStart: (t) => {
87
109
  h && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", e), p == null || p.setDragging({
88
110
  cardId: e,
89
- from: m
111
+ from: m.id
90
112
  }));
91
113
  },
92
114
  onDragEnd: () => p == null ? void 0 : p.setDragging(null),
93
- onClick: u,
115
+ onClick: o,
94
116
  children: [
95
- /* @__PURE__ */ a("div", {
117
+ /* @__PURE__ */ l("div", {
96
118
  className: "select-kanban__cardhead",
97
- children: [u ? /* @__PURE__ */ i("button", {
119
+ children: [o ? /* @__PURE__ */ c("button", {
98
120
  type: "button",
99
121
  className: "select-kanban__cardtitle",
100
122
  children: t
101
- }) : /* @__PURE__ */ i("span", {
123
+ }) : /* @__PURE__ */ c("span", {
102
124
  className: "select-kanban__cardtitle",
103
125
  children: t
104
- }), l ? /* @__PURE__ */ i("div", {
126
+ }), i ? /* @__PURE__ */ c("div", {
105
127
  className: "select-kanban__cardactions",
106
128
  onClick: (e) => e.stopPropagation(),
107
- children: l
129
+ children: i
108
130
  }) : null]
109
131
  }),
110
- r ? /* @__PURE__ */ i("p", {
132
+ n ? /* @__PURE__ */ c("p", {
111
133
  className: "select-kanban__cardsub",
112
- children: r
134
+ children: n
113
135
  }) : null,
114
- c ? /* @__PURE__ */ i("div", {
136
+ r ? /* @__PURE__ */ c("div", {
115
137
  className: "select-kanban__cardmeta",
116
- children: c
138
+ children: r
117
139
  }) : null
118
140
  ]
119
141
  });
120
142
  }
121
143
  //#endregion
122
- export { c as SelectKanban, l as SelectKanbanCard };
144
+ export { f as SelectKanban, p as SelectKanbanCard };
123
145
 
124
146
  //# sourceMappingURL=SelectKanban.js.map
@@ -48,6 +48,9 @@ export interface SelectKitMessages {
48
48
  clearSearch: string;
49
49
  searchOption: string;
50
50
  removeFilter: (label: string) => string;
51
+ /** 0.1.258: o selo da faceta que é um campo personalizado ("campo") e o que o leitor de tela ouve no lugar dele. */
52
+ customField: string;
53
+ customFieldLabel: string;
51
54
  };
52
55
  dataTable: {
53
56
  columns: string;
@@ -264,6 +267,37 @@ export interface SelectKitMessages {
264
267
  loadFailed: string;
265
268
  retry: string;
266
269
  };
270
+ /**
271
+ * 0.1.258: o grupo de avatares (SelectAvatarGroup) — o rótulo para o leitor de tela: os nomes à vista e o resto
272
+ * ("Ana, Bruno e mais 3"); sem nome nenhum, só a conta ("5 pessoas").
273
+ */
274
+ avatarGroup: {
275
+ label: (names: readonly string[], more: number) => string;
276
+ };
277
+ /**
278
+ * 0.1.258: o cadeado da etapa que anda sozinha (o passo do `SelectSteps` e a coluna do `SelectKanban` com `locked`) —
279
+ * o que o leitor de tela ouve no lugar do desenho.
280
+ */
281
+ lock: {
282
+ label: string;
283
+ };
284
+ /** 0.1.258: a moldura da página inteira (`SelectDeviceFrame variant="page"`): o nome da área que rola. */
285
+ deviceFrame: {
286
+ page: string;
287
+ };
288
+ /**
289
+ * 0.1.258: a lista que se ordena (`useSelectSortable`): o nome do item sem nome, o da alça, as instruções do teclado e
290
+ * o que o leitor de tela ouve ao pegar, mover, soltar e cancelar.
291
+ */
292
+ sortable: {
293
+ item: (position: number) => string;
294
+ handle: (name: string) => string;
295
+ instructions: string;
296
+ grabbed: (name: string, position: number, total: number) => string;
297
+ moved: (name: string, position: number, total: number) => string;
298
+ dropped: (name: string, position: number, total: number) => string;
299
+ canceled: (name: string, position: number) => string;
300
+ };
267
301
  }
268
302
  /** Os dicionários do kit, para quem quer conferir ou montar um texto do mesmo jeito. */
269
303
  export declare const selectKitMessages: Readonly<Record<SelectLocaleCode, SelectKitMessages>>;