@selectwin/kit 0.1.209 → 0.1.210

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,5 +1,5 @@
1
- import { ReactNode, ComponentPropsWithoutRef } from 'react';
2
- export declare function SelectDetailList({ children, stacked, compact, loading, }: {
1
+ import { ReactNode, HTMLAttributes, ComponentPropsWithoutRef } from 'react';
2
+ type SelectDetailListOwnProps = {
3
3
  children: ReactNode;
4
4
  stacked?: boolean;
5
5
  /**
@@ -10,7 +10,11 @@ export declare function SelectDetailList({ children, stacked, compact, loading,
10
10
  compact?: boolean;
11
11
  /** Shimmer every row's value. The labels stay — only the values are unknown. */
12
12
  loading?: boolean;
13
- }): import("react").JSX.Element;
13
+ /** 0.1.210: `dl` desenha a lista de definição (`<dl>`, `<dt>`, `<dd>`). Padrão `div`, como antes. */
14
+ as?: 'div' | 'dl';
15
+ };
16
+ export type SelectDetailListProps = SelectDetailListOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectDetailListOwnProps>;
17
+ export declare function SelectDetailList({ children, stacked, compact, loading, as, className, ...rest }: SelectDetailListProps): import("react").JSX.Element;
14
18
  type SelectDetailRowOwnProps = {
15
19
  label: ReactNode;
16
20
  children: ReactNode;
@@ -21,5 +25,5 @@ type SelectDetailRowOwnProps = {
21
25
  loading?: boolean;
22
26
  };
23
27
  export type SelectDetailRowProps = SelectDetailRowOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectDetailRowOwnProps>;
24
- export declare const SelectDetailRow: import('react').ForwardRefExoticComponent<SelectDetailRowOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectDetailRowOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
28
+ export declare const SelectDetailRow: import('react').ForwardRefExoticComponent<SelectDetailRowOwnProps & Omit<Omit<import('react').DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectDetailRowOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
25
29
  export {};
@@ -3,40 +3,44 @@ import { useSelectReveal as e } from "./internal/useSelectReveal.js";
3
3
  import { createContext as t, forwardRef as n, useContext as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region src/SelectDetail.tsx
6
- var o = t(!1);
7
- function s({ children: t, stacked: n = !1, compact: r = !1, loading: a = !1 }) {
8
- let s = e({
6
+ var o = t(!1), s = t(!1);
7
+ function c({ children: t, stacked: n = !1, compact: r = !1, loading: a = !1, as: c = "div", className: l, ...u }) {
8
+ let d = e({
9
9
  selector: ".select-detail",
10
10
  y: 8,
11
11
  duration: .45,
12
12
  stagger: .05,
13
13
  scroll: !0
14
- });
14
+ }), f = `select-detaillist${n ? " select-detaillist--stacked" : ""}${r ? " select-detaillist--compact" : ""}${l ? " " + l : ""}`;
15
15
  return /* @__PURE__ */ i(o.Provider, {
16
16
  value: a,
17
- children: /* @__PURE__ */ i("div", {
18
- className: `select-detaillist${n ? " select-detaillist--stacked" : ""}${r ? " select-detaillist--compact" : ""}`,
19
- ref: s,
20
- children: t
17
+ children: /* @__PURE__ */ i(s.Provider, {
18
+ value: c === "dl",
19
+ children: i(c === "dl" ? "dl" : "div", {
20
+ ...u,
21
+ className: f,
22
+ ref: d,
23
+ children: t
24
+ })
21
25
  })
22
26
  });
23
27
  }
24
- var c = n(function({ label: e, children: t, action: n, align: s = "center", loading: c, className: l, ...u }, d) {
25
- let f = r(o), p = c ?? f;
28
+ var l = n(function({ label: e, children: t, action: n, align: c = "center", loading: l, className: u, ...d }, f) {
29
+ let p = r(o), m = l ?? p, h = r(s), g = h ? "dt" : "div", _ = h ? "dd" : "div";
26
30
  return /* @__PURE__ */ a("div", {
27
- ref: d,
28
- ...u,
29
- className: `select-detail select-detail--${s}${l ? " " + l : ""}`,
31
+ ref: f,
32
+ ...d,
33
+ className: `select-detail select-detail--${c}${u ? " " + u : ""}`,
30
34
  children: [
31
- /* @__PURE__ */ i("div", {
35
+ /* @__PURE__ */ i(g, {
32
36
  className: "select-detail__label",
33
37
  children: e
34
38
  }),
35
- /* @__PURE__ */ i("div", {
39
+ /* @__PURE__ */ i(_, {
36
40
  className: "select-detail__value",
37
- children: p ? /* @__PURE__ */ i("span", { className: "select-skeleton select-detail__skel" }) : t
41
+ children: m ? /* @__PURE__ */ i("span", { className: "select-skeleton select-detail__skel" }) : t
38
42
  }),
39
- n && /* @__PURE__ */ i("div", {
43
+ n && /* @__PURE__ */ i(_, {
40
44
  className: "select-detail__action",
41
45
  children: n
42
46
  })
@@ -44,6 +48,6 @@ var c = n(function({ label: e, children: t, action: n, align: s = "center", load
44
48
  });
45
49
  });
46
50
  //#endregion
47
- export { s as SelectDetailList, c as SelectDetailRow };
51
+ export { c as SelectDetailList, l as SelectDetailRow };
48
52
 
49
53
  //# sourceMappingURL=SelectDetail.js.map
@@ -1,7 +1,9 @@
1
- import { ComponentPropsWithoutRef, ReactNode } from 'react';
1
+ import { ComponentPropsWithoutRef, ReactNode, HTMLAttributes } from 'react';
2
2
  type SelectKpiBandOwnProps = {
3
3
  children: ReactNode;
4
+ /** 0.1.210: `dl` para a faixa de números só de leitura (os `SelectKpiCard` viram `<dt>` e `<dd>`). Padrão `div`. */
5
+ as?: 'div' | 'dl';
4
6
  };
5
7
  export type SelectKpiBandProps = SelectKpiBandOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectKpiBandOwnProps>;
6
- export declare const SelectKpiBand: import('react').ForwardRefExoticComponent<SelectKpiBandOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children"> & import('react').RefAttributes<HTMLDivElement>>;
8
+ export declare const SelectKpiBand: import('react').ForwardRefExoticComponent<SelectKpiBandOwnProps & Omit<Omit<import('react').DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectKpiBandOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
7
9
  export {};
@@ -1,17 +1,28 @@
1
1
  /* empty css */
2
- import { forwardRef as e } from "react";
3
- import { jsx as t } from "react/jsx-runtime";
2
+ import { useInsideFrame as e } from "./internal/frame.js";
3
+ import { KpiListContext as t } from "./internal/kpiList.js";
4
+ import { forwardRef as n } from "react";
5
+ import { jsx as r } from "react/jsx-runtime";
4
6
  //#region src/SelectKpiBand.tsx
5
- var n = e(function({ children: e, className: n, ...r }, i) {
6
- return /* @__PURE__ */ t("div", {
7
- ref: i,
7
+ var i = n(function({ children: n, as: i = "div", className: a, ...o }, s) {
8
+ let c = `select-kpiband${e() ? " select-kpiband--nested" : ""}${a ? " " + a : ""}`;
9
+ return i === "dl" ? /* @__PURE__ */ r(t.Provider, {
10
+ value: !0,
11
+ children: /* @__PURE__ */ r("dl", {
12
+ ref: s,
13
+ ...o,
14
+ className: c,
15
+ children: n
16
+ })
17
+ }) : /* @__PURE__ */ r("div", {
18
+ ref: s,
8
19
  role: "group",
9
- ...r,
10
- className: `select-kpiband${n ? " " + n : ""}`,
11
- children: e
20
+ ...o,
21
+ className: c,
22
+ children: n
12
23
  });
13
24
  });
14
25
  //#endregion
15
- export { n as SelectKpiBand };
26
+ export { i as SelectKpiBand };
16
27
 
17
28
  //# sourceMappingURL=SelectKpiBand.js.map
@@ -1,54 +1,59 @@
1
1
  import { SelectInfoTip as e } from "./SelectInfoTip.js";
2
- import { forwardRef as t } from "react";
3
- import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
2
+ import { useKpiList as t } from "./internal/kpiList.js";
3
+ import { forwardRef as n } from "react";
4
+ import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
4
5
  //#region src/SelectKpiCard.tsx
5
- var a = t(function({ label: t, value: a, caption: o, chart: s, help: c, tone: l, bare: u = !1, onClick: d, selected: f = !1, loading: p = !1, className: m, ...h }, g) {
6
- let _ = d != null, v = _ ? {
6
+ var o = n(function({ label: n, value: o, caption: s, chart: c, help: l, tone: u, bare: d = !1, onClick: f, selected: p = !1, loading: m = !1, className: h, ...g }, _) {
7
+ let v = f != null, y = t(), b = y ? "dt" : "span", x = y ? "dd" : "span", S = y ? "dd" : "div", C = v ? {
7
8
  role: "button",
8
9
  tabIndex: 0,
9
- "aria-pressed": f,
10
- onClick: d,
10
+ "aria-pressed": p,
11
+ onClick: f,
11
12
  onKeyDown: (e) => {
12
- e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), d());
13
+ e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f());
13
14
  }
14
- } : {}, y = "select-kpi" + (u ? " select-kpi--bare" : "") + (_ ? " select-kpi--interactive" : "") + (_ && f ? " select-kpi--selected" : "") + (m ? " " + m : "");
15
- return /* @__PURE__ */ i("div", {
16
- ref: g,
17
- ...h,
18
- ...v,
19
- className: y,
20
- children: [/* @__PURE__ */ i("span", {
21
- className: `select-kpi__label${c == null ? "" : " select-kpi__label--help"}`,
22
- children: [c == null ? t : /* @__PURE__ */ r("span", {
15
+ } : {}, w = "select-kpi" + (d ? " select-kpi--bare" : "") + (v ? " select-kpi--interactive" : "") + (v && p ? " select-kpi--selected" : "") + (h ? " " + h : "");
16
+ return /* @__PURE__ */ a("div", {
17
+ ref: _,
18
+ ...g,
19
+ ...C,
20
+ className: w,
21
+ children: [/* @__PURE__ */ a(b, {
22
+ className: `select-kpi__label${l == null ? "" : " select-kpi__label--help"}`,
23
+ children: [l == null ? n : /* @__PURE__ */ i("span", {
23
24
  className: "select-kpi__labeltext",
24
- children: t
25
- }), c != null && /* @__PURE__ */ r(e, {
26
- content: c,
25
+ children: n
26
+ }), l != null && /* @__PURE__ */ i(e, {
27
+ content: l,
27
28
  placement: "top-end"
28
29
  })]
29
- }), p ? /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("span", {
30
+ }), m ? y ? /* @__PURE__ */ a("dd", {
31
+ className: "select-kpi__loading",
32
+ "aria-hidden": "true",
33
+ children: [/* @__PURE__ */ i("span", { className: "select-skeleton select-kpi__skelvalue" }), /* @__PURE__ */ i("span", { className: "select-skeleton select-kpi__skelcaption" })]
34
+ }) : /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("span", {
30
35
  className: "select-skeleton select-kpi__skelvalue",
31
36
  "aria-hidden": "true"
32
- }), /* @__PURE__ */ r("span", {
37
+ }), /* @__PURE__ */ i("span", {
33
38
  className: "select-skeleton select-kpi__skelcaption",
34
39
  "aria-hidden": "true"
35
- })] }) : /* @__PURE__ */ i(n, { children: [
36
- /* @__PURE__ */ r("span", {
37
- className: `select-kpi__value${l ? ` select-kpi__value--${l}` : ""}`,
38
- children: a
40
+ })] }) : /* @__PURE__ */ a(r, { children: [
41
+ /* @__PURE__ */ i(x, {
42
+ className: `select-kpi__value${u ? ` select-kpi__value--${u}` : ""}`,
43
+ children: o
39
44
  }),
40
- s != null && /* @__PURE__ */ r("div", {
45
+ c != null && /* @__PURE__ */ i(S, {
41
46
  className: "select-kpi__chart",
42
- children: s
47
+ children: c
43
48
  }),
44
- o != null && /* @__PURE__ */ r("span", {
49
+ s != null && /* @__PURE__ */ i(x, {
45
50
  className: "select-kpi__caption",
46
- children: o
51
+ children: s
47
52
  })
48
53
  ] })]
49
54
  });
50
55
  });
51
56
  //#endregion
52
- export { a as SelectKpiCard };
57
+ export { o as SelectKpiCard };
53
58
 
54
59
  //# sourceMappingURL=SelectKpiCard.js.map
@@ -19,5 +19,10 @@ export interface SelectPaginationProps {
19
19
  onPage?: (page: number) => void;
20
20
  /** Noun for the count label, e.g. "produtos". Defaults to "resultados" ("results" in English, `SelectLocaleProvider`). */
21
21
  noun?: string;
22
+ /**
23
+ * 0.1.210: a próxima página está chegando (a lista por cursor pede ao servidor). O "próxima" gira e fica
24
+ * `aria-busy`/`aria-disabled` sem perder o foco (o `disabled` o jogaria no `<body>`), e não aceita outro clique.
25
+ */
26
+ loading?: boolean;
22
27
  }
23
28
  export declare const SelectPagination: import('react').ForwardRefExoticComponent<SelectPaginationProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, keyof SelectPaginationProps> & import('react').RefAttributes<HTMLElement>>;
@@ -1,10 +1,11 @@
1
1
  /* empty css */
2
- import { ChevronLeftIcon as e, ChevronRightIcon as t } from "./icons.js";
3
- import { formatSelectNumber as n, useSelectLocale as r, useSelectMessages as i } from "./SelectLocale.js";
4
- import { forwardRef as a } from "react";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
2
+ import { SelectSpinner as e } from "./SelectSpinner.js";
3
+ import { ChevronLeftIcon as t, ChevronRightIcon as n } from "./icons.js";
4
+ import { formatSelectNumber as r, useSelectLocale as i, useSelectMessages as a } from "./SelectLocale.js";
5
+ import { forwardRef as o } from "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
7
  //#region src/SelectPagination.tsx
7
- function c(e, t) {
8
+ function l(e, t) {
8
9
  let n = [.../* @__PURE__ */ new Set([
9
10
  1,
10
11
  t,
@@ -15,7 +16,7 @@ function c(e, t) {
15
16
  for (let e of n) e - i > 1 && r.push("gap"), r.push(e), i = e;
16
17
  return r;
17
18
  }
18
- function l(e, t, n, r, i, a, o, s) {
19
+ function u(e, t, n, r, i, a, o, s) {
19
20
  let c = [];
20
21
  if (e != null) {
21
22
  if (e === 0) c.push(o.count(s(0), i));
@@ -26,50 +27,53 @@ function l(e, t, n, r, i, a, o, s) {
26
27
  }
27
28
  return a && r != null && r > 0 && c.push(o.pageOf(s(n), s(r))), c;
28
29
  }
29
- var u = a(function({ page: a, pageCount: u, total: d, pageSize: f, hasPrevious: p, hasNext: m, onPrevious: h, onNext: g, onPage: _, noun: v, className: y, ...b }, x) {
30
- let S = i().pagination, C = r(), w = (e) => n(e, C), T = v ?? S.noun, E = p ?? a > 1, D = m ?? (u == null || a < u), O = h ?? (_ ? () => _(a - 1) : void 0), k = g ?? (_ ? () => _(a + 1) : void 0), A = u != null && u > 1 && _ != null, j = A ? c(a, u) : [], M = l(d, f, a, u, T, A, S, w);
31
- return /* @__PURE__ */ s("nav", {
32
- ref: x,
33
- ...b,
34
- className: `select-pagination${y ? " " + y : ""}`,
35
- "aria-label": S.label,
36
- children: [/* @__PURE__ */ s("div", {
30
+ var d = o(function({ page: o, pageCount: d, total: f, pageSize: p, hasPrevious: m, hasNext: h, onPrevious: g, onNext: _, onPage: v, noun: y, loading: b = !1, className: x, ...S }, C) {
31
+ let w = a().pagination, T = i(), E = (e) => r(e, T), D = y ?? w.noun, O = m ?? o > 1, k = h ?? (d == null || o < d), A = g ?? (v ? () => v(o - 1) : void 0), j = _ ?? (v ? () => v(o + 1) : void 0), M = d != null && d > 1 && v != null, N = M ? l(o, d) : [], P = u(f, p, o, d, D, M, w, E);
32
+ return /* @__PURE__ */ c("nav", {
33
+ ref: C,
34
+ ...S,
35
+ className: `select-pagination${x ? " " + x : ""}`,
36
+ "aria-label": w.label,
37
+ children: [/* @__PURE__ */ c("div", {
37
38
  className: "select-pagination__controls",
38
39
  children: [
39
- /* @__PURE__ */ o("button", {
40
+ /* @__PURE__ */ s("button", {
40
41
  type: "button",
41
42
  className: "select-pagination__nav",
42
- onClick: O,
43
- disabled: !E || !O,
44
- "aria-label": S.previous,
45
- children: /* @__PURE__ */ o(e, {})
43
+ onClick: A,
44
+ disabled: !O || !A,
45
+ "aria-label": w.previous,
46
+ children: /* @__PURE__ */ s(t, {})
46
47
  }),
47
- A ? j.map((e, t) => e === "gap" ? /* @__PURE__ */ o("span", {
48
+ M ? N.map((e, t) => e === "gap" ? /* @__PURE__ */ s("span", {
48
49
  className: "select-pagination__gap",
49
50
  "aria-hidden": "true",
50
51
  children: "…"
51
- }, `gap-${t}`) : /* @__PURE__ */ o("button", {
52
+ }, `gap-${t}`) : /* @__PURE__ */ s("button", {
52
53
  type: "button",
53
- className: `select-pagination__page${e === a ? " is-active" : ""}`,
54
- onClick: () => _ == null ? void 0 : _(e),
55
- "aria-current": e === a ? "page" : void 0,
54
+ className: `select-pagination__page${e === o ? " is-active" : ""}`,
55
+ onClick: () => v == null ? void 0 : v(e),
56
+ "aria-current": e === o ? "page" : void 0,
56
57
  children: e
57
- }, e)) : /* @__PURE__ */ o("span", {
58
+ }, e)) : /* @__PURE__ */ s("span", {
58
59
  className: "select-pagination__current",
59
- children: u == null ? S.page(w(a)) : `${w(a)} / ${w(u)}`
60
+ "aria-live": "polite",
61
+ children: d == null ? w.page(E(o)) : `${E(o)} / ${E(d)}`
60
62
  }),
61
- /* @__PURE__ */ o("button", {
63
+ /* @__PURE__ */ s("button", {
62
64
  type: "button",
63
65
  className: "select-pagination__nav",
64
- onClick: k,
65
- disabled: !D || !k,
66
- "aria-label": S.next,
67
- children: /* @__PURE__ */ o(t, {})
66
+ onClick: b ? void 0 : j,
67
+ disabled: !k || !j,
68
+ "aria-disabled": b || void 0,
69
+ "aria-busy": b || void 0,
70
+ "aria-label": w.next,
71
+ children: b ? /* @__PURE__ */ s(e, { size: "sm" }) : /* @__PURE__ */ s(n, {})
68
72
  })
69
73
  ]
70
- }), M.length > 0 && /* @__PURE__ */ o("p", {
74
+ }), P.length > 0 && /* @__PURE__ */ s("p", {
71
75
  className: "select-pagination__count",
72
- children: M.map((e, t) => /* @__PURE__ */ o("span", {
76
+ children: P.map((e, t) => /* @__PURE__ */ s("span", {
73
77
  className: "select-pagination__part",
74
78
  children: t > 0 ? ` · ${e}` : e
75
79
  }, t))
@@ -77,6 +81,6 @@ var u = a(function({ page: a, pageCount: u, total: d, pageSize: f, hasPrevious:
77
81
  });
78
82
  });
79
83
  //#endregion
80
- export { u as SelectPagination };
84
+ export { d as SelectPagination };
81
85
 
82
86
  //# sourceMappingURL=SelectPagination.js.map
package/dist/index.d.ts CHANGED
@@ -305,6 +305,7 @@ export type { SelectOfferPriceProps } from './SelectOfferPrice';
305
305
  export type { SelectRatingQuoteProps } from './SelectRatingQuote';
306
306
  export type { SelectMarkStackProps, SelectMark } from './SelectMarkStack';
307
307
  export type { SelectListPagination } from './internal/listChrome';
308
+ export { SelectListFooter } from './internal/listChrome';
308
309
  export type { SelectPaginationProps } from './SelectPagination';
309
310
  export type { SelectFilterDef } from './SelectFilterBar';
310
311
  export type { SelectTagOption } from './SelectTagSelect';