@selectwin/kit 0.1.244 → 0.1.246

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,94 +1,96 @@
1
1
  /* empty css */
2
2
  import { ChevronDownIcon as e } from "./icons.js";
3
3
  import { SelectInfoTip as t } from "./SelectInfoTip.js";
4
- import { FrameBody as n, useInsideFrame as r } from "./internal/frame.js";
5
- import { inertProps as i } from "./internal/inert.js";
6
- import { forwardRef as a, useId as o, useState as s } from "react";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
4
+ import { registerSheetFrame as n } from "./internal/sheetBands.js";
5
+ import { FrameBody as r, useInsideFrame as i } from "./internal/frame.js";
6
+ import { inertProps as a } from "./internal/inert.js";
7
+ import { forwardRef as o, useId as s, useState as c } from "react";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
8
9
  //#region src/SelectSection.tsx
9
- var u = a(function({ title: a, help: u, description: d, action: f, collapsible: p = !1, defaultOpen: m = !0, open: h, onOpenChange: g, footer: _, flush: v = !1, list: y = !1, children: b, className: x, ...S }, C) {
10
- let [w, T] = s(m), E = h ?? w, D = o(), O = () => {
10
+ var d = o(function({ title: n, help: o, description: d, action: f, collapsible: p = !1, defaultOpen: m = !0, open: h, onOpenChange: g, footer: _, flush: v = !1, list: y = !1, children: b, className: x, ...S }, C) {
11
+ let [w, T] = c(m), E = h ?? w, D = s(), O = () => {
11
12
  h === void 0 && T(!E), g == null || g(!E);
12
- }, k = (r() ? " select-section--nested" : "") + (v ? " select-section--flush" : "") + (y ? " select-section--list" : ""), A = y ? "list" : "body";
13
- return p ? /* @__PURE__ */ l("div", {
13
+ }, k = (i() ? " select-section--nested" : "") + (v ? " select-section--flush" : "") + (y ? " select-section--list" : ""), A = y ? "list" : "body";
14
+ return p ? /* @__PURE__ */ u("div", {
14
15
  ref: C,
15
16
  ...S,
16
17
  className: `select-section select-section--collapsible${k}${E ? " is-open" : ""}${x ? " " + x : ""}`,
17
- children: [/* @__PURE__ */ l("button", {
18
+ children: [/* @__PURE__ */ u("button", {
18
19
  type: "button",
19
20
  className: "select-section__head select-section__head--toggle",
20
21
  "aria-expanded": E,
21
22
  "aria-controls": D,
22
23
  onClick: O,
23
- children: [/* @__PURE__ */ l("span", {
24
+ children: [/* @__PURE__ */ u("span", {
24
25
  className: "select-section__heading",
25
- children: [a && /* @__PURE__ */ c("span", {
26
+ children: [n && /* @__PURE__ */ l("span", {
26
27
  className: "select-section__title",
27
- children: a
28
- }), d && /* @__PURE__ */ c("span", {
28
+ children: n
29
+ }), d && /* @__PURE__ */ l("span", {
29
30
  className: "select-section__desc",
30
31
  children: d
31
32
  })]
32
- }), /* @__PURE__ */ c("span", {
33
+ }), /* @__PURE__ */ l("span", {
33
34
  className: "select-section__chevron",
34
35
  "aria-hidden": "true",
35
- children: /* @__PURE__ */ c(e, {})
36
+ children: /* @__PURE__ */ l(e, {})
36
37
  })]
37
- }), /* @__PURE__ */ c("div", {
38
+ }), /* @__PURE__ */ l("div", {
38
39
  id: D,
39
40
  className: "select-section__collapse",
40
41
  "data-open": E,
41
- ...i(!E),
42
- children: /* @__PURE__ */ l("div", {
42
+ ...a(!E),
43
+ children: /* @__PURE__ */ u("div", {
43
44
  className: "select-section__collapsewrap",
44
- children: [/* @__PURE__ */ c("div", {
45
+ children: [/* @__PURE__ */ l("div", {
45
46
  className: "select-section__body",
46
- children: /* @__PURE__ */ c(n, {
47
+ children: /* @__PURE__ */ l(r, {
47
48
  kind: A,
48
49
  children: b
49
50
  })
50
- }), _ != null && _ !== "" && /* @__PURE__ */ c("div", {
51
+ }), _ != null && _ !== "" && /* @__PURE__ */ l("div", {
51
52
  className: "select-section__foot",
52
53
  children: _
53
54
  })]
54
55
  })
55
56
  })]
56
- }) : /* @__PURE__ */ l("div", {
57
+ }) : /* @__PURE__ */ u("div", {
57
58
  ref: C,
58
59
  ...S,
59
60
  className: `select-section${k}${x ? " " + x : ""}`,
60
61
  children: [
61
- (a || d || f) && /* @__PURE__ */ l("div", {
62
+ (n || d || f) && /* @__PURE__ */ u("div", {
62
63
  className: "select-section__head",
63
- children: [/* @__PURE__ */ l("div", {
64
+ children: [/* @__PURE__ */ u("div", {
64
65
  className: "select-section__heading",
65
- children: [a && /* @__PURE__ */ l("h2", {
66
- className: `select-section__title${u == null ? "" : " select-section__title--help"}`,
67
- children: [a, u != null && /* @__PURE__ */ c(t, { content: u })]
68
- }), d && /* @__PURE__ */ c("p", {
66
+ children: [n && /* @__PURE__ */ u("h2", {
67
+ className: `select-section__title${o == null ? "" : " select-section__title--help"}`,
68
+ children: [n, o != null && /* @__PURE__ */ l(t, { content: o })]
69
+ }), d && /* @__PURE__ */ l("p", {
69
70
  className: "select-section__desc",
70
71
  children: d
71
72
  })]
72
- }), f ? /* @__PURE__ */ c("div", {
73
+ }), f ? /* @__PURE__ */ l("div", {
73
74
  className: "select-section__action",
74
75
  children: f
75
76
  }) : null]
76
77
  }),
77
- /* @__PURE__ */ c("div", {
78
+ /* @__PURE__ */ l("div", {
78
79
  className: "select-section__body",
79
- children: /* @__PURE__ */ c(n, {
80
+ children: /* @__PURE__ */ l(r, {
80
81
  kind: A,
81
82
  children: b
82
83
  })
83
84
  }),
84
- _ != null && _ !== "" && /* @__PURE__ */ c("div", {
85
+ _ != null && _ !== "" && /* @__PURE__ */ l("div", {
85
86
  className: "select-section__foot",
86
87
  children: _
87
88
  })
88
89
  ]
89
90
  });
90
91
  });
92
+ n(d);
91
93
  //#endregion
92
- export { u as SelectSection };
94
+ export { d as SelectSection };
93
95
 
94
96
  //# sourceMappingURL=SelectSection.js.map
@@ -0,0 +1 @@
1
+ export declare function isDevBuild(): boolean;
@@ -0,0 +1,12 @@
1
+ //#region src/internal/dev.ts
2
+ function e() {
3
+ try {
4
+ return process.env.NODE_ENV !== "production";
5
+ } catch {
6
+ return !1;
7
+ }
8
+ }
9
+ //#endregion
10
+ export { e as isDevBuild };
11
+
12
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ /** Uma moldura que, no corpo da folha, é uma faixa por si (a seção, a lista, os fatos, o JSON). */
3
+ export declare function registerSheetFrame(type: object): void;
4
+ /** Um agrupador que, no corpo da folha, se desfaz quando junta molduras (o `SelectStack`). */
5
+ export declare function registerSheetGroup(type: object): void;
6
+ export interface SheetBand {
7
+ key: string;
8
+ node: ReactNode;
9
+ }
10
+ /** As faixas do corpo da folha: um filho, uma faixa; o agrupador de molduras dá uma faixa para cada filho dele. */
11
+ export declare function sheetBands(children: ReactNode): SheetBand[];
@@ -0,0 +1,44 @@
1
+ import { Children as e, Fragment as t, isValidElement as n } from "react";
2
+ //#region src/internal/sheetBands.ts
3
+ var r = /* @__PURE__ */ new WeakSet(), i = /* @__PURE__ */ new WeakSet();
4
+ function a(e) {
5
+ r.add(e);
6
+ }
7
+ function o(e) {
8
+ i.add(e);
9
+ }
10
+ function s(e) {
11
+ return n(e) && (typeof e.type == "function" || typeof e.type == "object") ? e.type : null;
12
+ }
13
+ function c(r, i) {
14
+ let a = [];
15
+ return e.toArray(r).forEach((e, r) => {
16
+ let o = `${i}${n(e) && e.key != null ? e.key : r}`;
17
+ n(e) && e.type === t ? a.push(...c(e.props.children, `${o}/`)) : a.push({
18
+ key: o,
19
+ node: e
20
+ });
21
+ }), a;
22
+ }
23
+ function l(e) {
24
+ let t = [];
25
+ for (let n of c(e, "")) {
26
+ let e = s(n.node);
27
+ if (e && i.has(e)) {
28
+ let e = c(n.node.props.children, `${n.key}/`);
29
+ if (e.some((e) => {
30
+ let t = s(e.node);
31
+ return t != null && r.has(t);
32
+ })) {
33
+ t.push(...e);
34
+ continue;
35
+ }
36
+ }
37
+ t.push(n);
38
+ }
39
+ return t;
40
+ }
41
+ //#endregion
42
+ export { a as registerSheetFrame, o as registerSheetGroup, l as sheetBands };
43
+
44
+ //# sourceMappingURL=sheetBands.js.map