@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,124 +1,164 @@
1
- import { useEffect as e, useRef as t, useState as n } from "react";
2
- import { Fragment as r, 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 { SelectScrollArea as n } from "./SelectScrollArea.js";
4
+ import { useEffect as r, useRef as i, useState as a } from "react";
5
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
3
6
  //#region src/SelectChannelPreview.tsx
4
- function o({ children: e }) {
5
- return /* @__PURE__ */ i("div", {
7
+ function l({ children: e }) {
8
+ return /* @__PURE__ */ s("div", {
6
9
  className: "select-previewstage",
7
10
  children: e
8
11
  });
9
12
  }
10
- function s(e) {
13
+ function u(e) {
11
14
  var t, n;
12
15
  let r = e.trim().split(/\s+/).filter(Boolean);
13
16
  return (r.length > 1 ? (((t = r[0]) == null ? void 0 : t[0]) ?? "") + (((n = r[1]) == null ? void 0 : n[0]) ?? "") : e.slice(0, 2)).toUpperCase();
14
17
  }
15
- function c({ variant: e, title: t, subtitle: n, children: r }) {
16
- return /* @__PURE__ */ a("div", {
17
- className: `select-device select-device--${e}`,
18
- children: [/* @__PURE__ */ a("div", {
18
+ function d({ variant: r, title: i, subtitle: a, device: o = "desktop", address: l, height: d, label: f, children: p }) {
19
+ let m = t().deviceFrame;
20
+ if (r === "page") {
21
+ let t = o === "mobile", r = d == null ? void 0 : { height: typeof d == "number" ? `${d}px` : d };
22
+ return /* @__PURE__ */ c("div", {
23
+ className: `select-device select-device--page select-device--${t ? "mobile" : "desktop"}`,
24
+ style: r,
25
+ children: [/* @__PURE__ */ c("div", {
26
+ className: "select-device__bar",
27
+ children: [!t && /* @__PURE__ */ c("span", {
28
+ className: "select-device__dots",
29
+ "aria-hidden": "true",
30
+ children: [
31
+ /* @__PURE__ */ s("span", {}),
32
+ /* @__PURE__ */ s("span", {}),
33
+ /* @__PURE__ */ s("span", {})
34
+ ]
35
+ }), l ? /* @__PURE__ */ c("span", {
36
+ className: "select-device__address",
37
+ children: [/* @__PURE__ */ s("span", {
38
+ className: "select-device__lock",
39
+ "aria-hidden": "true",
40
+ children: /* @__PURE__ */ s(e, {})
41
+ }), /* @__PURE__ */ s("span", {
42
+ className: "select-device__url",
43
+ children: l
44
+ })]
45
+ }) : null]
46
+ }), d == null ? /* @__PURE__ */ s("div", {
47
+ className: "select-device__page",
48
+ children: p
49
+ }) : /* @__PURE__ */ s(n, {
50
+ className: "select-device__page",
51
+ label: f ?? m.page,
52
+ children: p
53
+ })]
54
+ });
55
+ }
56
+ return /* @__PURE__ */ c("div", {
57
+ className: `select-device select-device--${r}`,
58
+ children: [/* @__PURE__ */ c("div", {
19
59
  className: "select-device__head",
20
- children: [/* @__PURE__ */ i("span", {
60
+ children: [/* @__PURE__ */ s("span", {
21
61
  className: "select-device__avatar",
22
62
  "aria-hidden": "true",
23
- children: e === "whatsapp" && t ? s(t) : null
24
- }), (t || n) && /* @__PURE__ */ a("span", {
63
+ children: r === "whatsapp" && i ? u(i) : null
64
+ }), (i || a) && /* @__PURE__ */ c("span", {
25
65
  className: "select-device__who",
26
- children: [t && /* @__PURE__ */ i("span", {
66
+ children: [i && /* @__PURE__ */ s("span", {
27
67
  className: "select-device__name",
28
- children: t
29
- }), n && /* @__PURE__ */ i("span", {
68
+ children: i
69
+ }), a && /* @__PURE__ */ s("span", {
30
70
  className: "select-device__sub",
31
- children: n
71
+ children: a
32
72
  })]
33
73
  })]
34
- }), /* @__PURE__ */ i("div", {
74
+ }), /* @__PURE__ */ s("div", {
35
75
  className: "select-device__body",
36
- children: r
76
+ children: p
37
77
  })]
38
78
  });
39
79
  }
40
- function l({ variant: e, media: t, buttons: n, empty: r = !1, backdrop: o = !1, children: s }) {
41
- let c = /* @__PURE__ */ a("div", {
80
+ function f({ variant: e, media: t, buttons: n, empty: r = !1, backdrop: i = !1, children: a }) {
81
+ let o = /* @__PURE__ */ c("div", {
42
82
  className: `select-bubble select-bubble--${e}`,
43
83
  children: [
44
- t != null && t !== "" && /* @__PURE__ */ i("div", {
84
+ t != null && t !== "" && /* @__PURE__ */ s("div", {
45
85
  className: "select-bubble__media",
46
86
  children: t
47
87
  }),
48
- r ? /* @__PURE__ */ i("span", {
88
+ r ? /* @__PURE__ */ s("span", {
49
89
  className: "select-bubble__empty",
50
- children: s
51
- }) : s,
52
- n && n.length > 0 && /* @__PURE__ */ i("span", {
90
+ children: a
91
+ }) : a,
92
+ n && n.length > 0 && /* @__PURE__ */ s("span", {
53
93
  className: "select-bubble__buttons",
54
- children: n.map((e, t) => /* @__PURE__ */ i("span", {
94
+ children: n.map((e, t) => /* @__PURE__ */ s("span", {
55
95
  className: "select-bubble__button",
56
96
  children: e
57
97
  }, t))
58
98
  })
59
99
  ]
60
100
  });
61
- return o ? /* @__PURE__ */ i("div", {
101
+ return i ? /* @__PURE__ */ s("div", {
62
102
  className: "select-chatbg",
63
- children: c
64
- }) : c;
103
+ children: o
104
+ }) : o;
65
105
  }
66
- function u({ from: e, subject: t, emptySubject: n = "Sem assunto", device: o = "desktop", srcDoc: s, loading: c = !1, frameTitle: l = "O e-mail" }) {
106
+ function p({ from: e, subject: t, emptySubject: n = "Sem assunto", device: r = "desktop", srcDoc: i, loading: a = !1, frameTitle: l = "O e-mail" }) {
67
107
  let u = t != null && t !== "" && t !== !1;
68
- return /* @__PURE__ */ a("div", {
69
- className: `select-mailpreview${o === "mobile" ? " select-mailpreview--mobile" : ""}`,
70
- children: [/* @__PURE__ */ a("div", {
108
+ return /* @__PURE__ */ c("div", {
109
+ className: `select-mailpreview${r === "mobile" ? " select-mailpreview--mobile" : ""}`,
110
+ children: [/* @__PURE__ */ c("div", {
71
111
  className: "select-mailpreview__head",
72
- children: [((e == null ? void 0 : e.name) || (e == null ? void 0 : e.email)) && /* @__PURE__ */ a("span", {
112
+ children: [((e == null ? void 0 : e.name) || (e == null ? void 0 : e.email)) && /* @__PURE__ */ c("span", {
73
113
  className: "select-mailpreview__from",
74
114
  children: [
75
- e.name && /* @__PURE__ */ i("b", { children: e.name }),
115
+ e.name && /* @__PURE__ */ s("b", { children: e.name }),
76
116
  " ",
77
- e.email && /* @__PURE__ */ a(r, { children: [
117
+ e.email && /* @__PURE__ */ c(o, { children: [
78
118
  "<",
79
119
  e.email,
80
120
  ">"
81
121
  ] })
82
122
  ]
83
- }), /* @__PURE__ */ i("span", {
123
+ }), /* @__PURE__ */ s("span", {
84
124
  className: `select-mailpreview__subject${u ? "" : " select-mailpreview__subject--empty"}`,
85
125
  children: u ? t : n
86
126
  })]
87
- }), c ? /* @__PURE__ */ i("span", { className: "select-skeleton select-mailpreview__loading" }) : s == null ? null : /* @__PURE__ */ i(d, {
88
- srcDoc: s,
127
+ }), a ? /* @__PURE__ */ s("span", { className: "select-skeleton select-mailpreview__loading" }) : i == null ? null : /* @__PURE__ */ s(m, {
128
+ srcDoc: i,
89
129
  title: l
90
130
  })]
91
131
  });
92
132
  }
93
- function d({ srcDoc: r, title: a }) {
94
- let o = t(null), [s, c] = n(null), l = t(null);
95
- e(() => () => {
133
+ function m({ srcDoc: e, title: t }) {
134
+ let n = i(null), [o, c] = a(null), l = i(null);
135
+ r(() => () => {
96
136
  var e;
97
137
  return (e = l.current) == null ? void 0 : e.disconnect();
98
138
  }, []);
99
139
  let u = () => {
100
140
  var e, t;
101
- let n = (e = o.current) == null ? void 0 : e.contentDocument;
102
- if (!(n != null && n.documentElement)) return;
103
- let r = Math.max(n.documentElement.scrollHeight, ((t = n.body) == null ? void 0 : t.scrollHeight) ?? 0);
104
- r > 0 && c(r);
141
+ let r = (e = n.current) == null ? void 0 : e.contentDocument;
142
+ if (!(r != null && r.documentElement)) return;
143
+ let i = Math.max(r.documentElement.scrollHeight, ((t = r.body) == null ? void 0 : t.scrollHeight) ?? 0);
144
+ i > 0 && c(i);
105
145
  };
106
- return /* @__PURE__ */ i("iframe", {
107
- ref: o,
146
+ return /* @__PURE__ */ s("iframe", {
147
+ ref: n,
108
148
  className: "select-mailpreview__frame",
109
149
  sandbox: "allow-same-origin",
110
- title: a,
111
- srcDoc: r,
112
- style: s ? { height: s } : void 0,
150
+ title: t,
151
+ srcDoc: e,
152
+ style: o ? { height: o } : void 0,
113
153
  onLoad: () => {
114
154
  var e, t;
115
155
  u(), (e = l.current) == null || e.disconnect();
116
- let n = (t = o.current) == null || (t = t.contentDocument) == null ? void 0 : t.body;
117
- n && typeof ResizeObserver < "u" && (l.current = new ResizeObserver(() => u()), l.current.observe(n));
156
+ let r = (t = n.current) == null || (t = t.contentDocument) == null ? void 0 : t.body;
157
+ r && typeof ResizeObserver < "u" && (l.current = new ResizeObserver(() => u()), l.current.observe(r));
118
158
  }
119
159
  });
120
160
  }
121
161
  //#endregion
122
- export { c as SelectDeviceFrame, u as SelectMailPreview, l as SelectMessageBubble, o as SelectPreviewStage };
162
+ export { d as SelectDeviceFrame, p as SelectMailPreview, f as SelectMessageBubble, l as SelectPreviewStage };
123
163
 
124
164
  //# sourceMappingURL=SelectChannelPreview.js.map
@@ -0,0 +1,14 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ type SelectFieldsetOwnProps = {
3
+ /** O nome do grupo, na `<legend>`. */
4
+ legend: ReactNode;
5
+ /** A linha que explica o grupo, no começo dele (e a descrição dele para o leitor de tela). */
6
+ description?: ReactNode;
7
+ /** `plain` (o padrão): sem moldura. `highlight`: a caixa em destaque, no acento do app. */
8
+ variant?: 'plain' | 'highlight';
9
+ /** A legenda só para o leitor de tela. */
10
+ hideLegend?: boolean;
11
+ };
12
+ export type SelectFieldsetProps = SelectFieldsetOwnProps & Omit<ComponentPropsWithoutRef<'fieldset'>, keyof SelectFieldsetOwnProps>;
13
+ export declare const SelectFieldset: import('react').ForwardRefExoticComponent<SelectFieldsetOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref">, keyof SelectFieldsetOwnProps> & import('react').RefAttributes<HTMLFieldSetElement>>;
14
+ export {};
@@ -0,0 +1,27 @@
1
+ import { forwardRef as e, useId as t } from "react";
2
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ //#region src/SelectFieldset.tsx
4
+ var i = e(function({ legend: e, description: i, variant: a = "plain", hideLegend: o = !1, className: s, children: c, "aria-describedby": l, ...u }, d) {
5
+ let f = t(), p = i != null && i !== !1 && i !== "", m = [l, p ? f : null].filter(Boolean).join(" ") || void 0;
6
+ return /* @__PURE__ */ r("fieldset", {
7
+ ref: d,
8
+ ...u,
9
+ "aria-describedby": m,
10
+ className: `select-fieldset select-fieldset--${a}${s ? ` ${s}` : ""}`,
11
+ children: [/* @__PURE__ */ n("legend", {
12
+ className: `select-fieldset__legend${o ? " select-visually-hidden" : ""}`,
13
+ children: e
14
+ }), /* @__PURE__ */ r("div", {
15
+ className: "select-fieldset__body",
16
+ children: [p && /* @__PURE__ */ n("p", {
17
+ id: f,
18
+ className: "select-fieldset__description",
19
+ children: i
20
+ }), c]
21
+ })]
22
+ });
23
+ });
24
+ //#endregion
25
+ export { i as SelectFieldset };
26
+
27
+ //# sourceMappingURL=SelectFieldset.js.map
@@ -2,13 +2,18 @@ import { ReactNode, ComponentPropsWithoutRef } from 'react';
2
2
  export interface SelectFilterDef {
3
3
  key: string;
4
4
  label: string;
5
- type: 'text' | 'select' | 'multiselect' | 'date';
5
+ /** 0.1.258: `toggle` — a faceta de marcar, que liga e desliga num clique (sem painel). */
6
+ type: 'text' | 'select' | 'multiselect' | 'date' | 'toggle';
6
7
  placeholder?: string;
7
8
  options?: {
8
9
  label: string;
9
10
  value: string;
10
11
  }[];
11
12
  pinned?: boolean;
13
+ /** 0.1.258: o valor da faceta de marcar ligada (padrão `'true'`); desligada, vazio. */
14
+ toggleValue?: string;
15
+ /** 0.1.258: a faceta é um campo personalizado — o selo "campo" ao lado do nome. */
16
+ custom?: boolean;
12
17
  /**
13
18
  * The value is set but NOT usable — say so on the filter itself.
14
19
  *