@selectwin/kit 0.1.205 → 0.1.207

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.
@@ -7,13 +7,28 @@ export interface SelectPageAction {
7
7
  loading?: boolean;
8
8
  icon?: ReactNode;
9
9
  }
10
- type SelectPageOwnProps = {
10
+ export interface SelectPageBack {
11
+ /** O clique. Com `to`, roda antes da navegação do link. */
12
+ onAction?: () => void;
13
+ /** 0.1.206: o endereço do app — o voltar é o `<Link>` do roteador (abre em outra aba, copia o endereço). */
14
+ to?: string;
15
+ /** O nome do voltar para o leitor de tela (o padrão: "Voltar"). */
16
+ content?: string;
17
+ }
18
+ /** O cabeçalho da página: o voltar, o contexto, o título, o meta, a descrição, as ações e o destaque (0.1.206). */
19
+ export type SelectPageHeaderProps = {
11
20
  title?: ReactNode;
12
21
  subtitle?: ReactNode;
13
22
  /** Acima do título, em caixa-alta espaçada ("Produção · Segunda, 02 de novembro") — 0.1.188, o tom corporativo. */
14
23
  eyebrow?: ReactNode;
15
- /** Um filete separa o cabeçalho do conteúdo (as telas de painel, como o Início). */
16
- divided?: boolean;
24
+ /** 0.1.206: a linha acima do título, antes do `eyebrow` (a organização e o workspace, com o trocador). */
25
+ context?: ReactNode;
26
+ /** 0.1.206: os avisos da página, em pilha acima do cabeçalho (a conta em análise, o limite do mês). */
27
+ notices?: ReactNode;
28
+ /** 0.1.206: uma linha sob o título (o estado, as etiquetas). */
29
+ meta?: ReactNode;
30
+ /** 0.1.206: um destaque à direita (o carrossel das análises). Com ele, as ações vão para baixo do texto. */
31
+ aside?: ReactNode;
17
32
  primaryAction?: SelectPageAction;
18
33
  secondaryActions?: SelectPageAction[];
19
34
  /** Custom node in the header action area (e.g. an "Ações" overflow menu on detail
@@ -23,17 +38,26 @@ type SelectPageOwnProps = {
23
38
  backAction?: SelectPageBack | null;
24
39
  /** Os níveis de CIMA da página, sobre o título ("Club › Cursos"); o título é o nível atual. */
25
40
  breadcrumbs?: SelectBreadcrumbItem[];
41
+ };
42
+ type SelectPageOwnProps = SelectPageHeaderProps & {
43
+ /** Um filete separa o cabeçalho do conteúdo (as telas de painel, como o Início). */
44
+ divided?: boolean;
26
45
  children: ReactNode;
27
46
  };
28
- export interface SelectPageBack {
29
- onAction: () => void;
30
- content?: string;
31
- }
32
47
  /** O voltar das páginas que não dizem o seu (ex.: a tela anterior do app). */
33
48
  export declare function SelectPageBackProvider({ value, children }: {
34
49
  value: SelectPageBack | null;
35
50
  children: ReactNode;
36
51
  }): import("react").JSX.Element;
52
+ /**
53
+ * O cabeçalho da página sozinho (0.1.206), para a moldura que já dá a coluna da página. Devolve os avisos e a linha do
54
+ * cabeçalho lado a lado (sem uma caixa em volta): dentro da SelectPage, eles são filhos da coluna dela.
55
+ */
56
+ export declare function SelectPageHeader({ title, subtitle, eyebrow, context, notices, meta, aside, primaryAction, secondaryActions, headerActions, backAction: ownBack, breadcrumbs, }: SelectPageHeaderProps): import("react").JSX.Element;
37
57
  export type SelectPageProps = SelectPageOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectPageOwnProps>;
38
- export declare const SelectPage: import('react').ForwardRefExoticComponent<SelectPageOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectPageOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
58
+ export declare const SelectPage: import('react').ForwardRefExoticComponent<SelectPageHeaderProps & {
59
+ /** Um filete separa o cabeçalho do conteúdo (as telas de painel, como o Início). */
60
+ divided?: boolean;
61
+ children: ReactNode;
62
+ } & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "children" | keyof SelectPageHeaderProps | "divided"> & import('react').RefAttributes<HTMLDivElement>>;
39
63
  export {};
@@ -1,85 +1,135 @@
1
1
  /* empty css */
2
2
  import { SelectButton as e } from "./SelectButton.js";
3
- import { ArrowLeftIcon as t } from "./icons.js";
4
- import { useSelectMessages as n } from "./SelectLocale.js";
5
- import { SelectBreadcrumb as r } from "./SelectBreadcrumb.js";
6
- import { createContext as i, forwardRef as a, useContext as o } from "react";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
3
+ import { safeHref as t } from "./internal/safeHref.js";
4
+ import { ArrowLeftIcon as n } from "./icons.js";
5
+ import { useSelectMessages as r } from "./SelectLocale.js";
6
+ import { SelectBreadcrumb as i } from "./SelectBreadcrumb.js";
7
+ import { createContext as a, forwardRef as o, useContext as s } from "react";
8
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import { Link as d } from "react-router-dom";
8
10
  //#region src/SelectPage.tsx
9
- var l = i(null);
10
- function u({ value: e, children: t }) {
11
- return /* @__PURE__ */ s(l.Provider, {
11
+ var f = a(null);
12
+ function p({ value: e, children: t }) {
13
+ return /* @__PURE__ */ l(f.Provider, {
12
14
  value: e,
13
15
  children: t
14
16
  });
15
17
  }
16
- var d = a(function({ title: i, subtitle: a, eyebrow: u, divided: d = !1, primaryAction: f, secondaryActions: p, headerActions: m, backAction: h, breadcrumbs: g, children: _, className: v, ...y }, b) {
17
- let x = n(), S = o(l), C = h === null ? null : h ?? S, w = !!f || p && p.length > 0 || !!m, T = C || i || a || u || w;
18
- return /* @__PURE__ */ c("div", {
19
- ref: b,
20
- ...y,
21
- className: `select select-page${d ? " select-page--divided" : ""}${v ? " " + v : ""}`,
22
- children: [T && /* @__PURE__ */ c("div", {
23
- className: "select-page__header",
24
- children: [/* @__PURE__ */ c("div", {
18
+ function m({ back: e, label: r }) {
19
+ let i = e.to === void 0 ? void 0 : t(e.to);
20
+ return i === void 0 ? /* @__PURE__ */ l("button", {
21
+ type: "button",
22
+ className: "select-page__back",
23
+ onClick: e.onAction,
24
+ "aria-label": r,
25
+ children: /* @__PURE__ */ l(n, {})
26
+ }) : /* @__PURE__ */ l(d, {
27
+ to: i,
28
+ className: "select-page__back",
29
+ "aria-label": r,
30
+ onClick: e.onAction,
31
+ children: /* @__PURE__ */ l(n, {})
32
+ });
33
+ }
34
+ function h({ title: t, subtitle: n, eyebrow: a, context: o, notices: d, meta: p, aside: h, primaryAction: g, secondaryActions: _, headerActions: v, backAction: y, breadcrumbs: b }) {
35
+ let x = r(), S = s(f), C = y === null ? null : y ?? S, w = !!g || _ && _.length > 0 || !!v, T = C || t || n || a || w || o || p || h, E = w ? /* @__PURE__ */ u("div", {
36
+ className: `select-page__actions${h ? " select-page__actions--below" : ""}`,
37
+ children: [
38
+ _ == null ? void 0 : _.map((t, n) => /* @__PURE__ */ l(e, {
39
+ variant: "secondary",
40
+ size: "sm",
41
+ inline: !0,
42
+ icon: t.icon,
43
+ disabled: t.disabled,
44
+ loading: t.loading,
45
+ onClick: t.onAction,
46
+ children: t.content
47
+ }, n)),
48
+ g && /* @__PURE__ */ l(e, {
49
+ variant: "primary",
50
+ size: "sm",
51
+ inline: !0,
52
+ icon: g.icon,
53
+ disabled: g.disabled,
54
+ loading: g.loading,
55
+ onClick: g.onAction,
56
+ children: g.content
57
+ }),
58
+ v
59
+ ]
60
+ }) : null;
61
+ return /* @__PURE__ */ u(c, { children: [d != null && d !== !1 && /* @__PURE__ */ l("div", {
62
+ className: "select-page__notices",
63
+ children: d
64
+ }), T && /* @__PURE__ */ u("div", {
65
+ className: `select-page__header${h ? " select-page__header--aside" : ""}`,
66
+ children: [
67
+ /* @__PURE__ */ u("div", {
25
68
  className: "select-page__heading",
26
- children: [C && /* @__PURE__ */ s("button", {
27
- type: "button",
28
- className: "select-page__back",
29
- onClick: C.onAction,
30
- "aria-label": C.content ?? x.common.back,
31
- children: /* @__PURE__ */ s(t, {})
32
- }), /* @__PURE__ */ c("div", {
69
+ children: [C && /* @__PURE__ */ l(m, {
70
+ back: C,
71
+ label: C.content ?? x.common.back
72
+ }), /* @__PURE__ */ u("div", {
33
73
  className: "select-page__head",
34
74
  children: [
35
- g && g.length > 0 && /* @__PURE__ */ s(r, {
36
- items: g,
75
+ b && b.length > 0 && /* @__PURE__ */ l(i, {
76
+ items: b,
37
77
  lastIsCurrent: !1
38
78
  }),
39
- u && /* @__PURE__ */ s("p", {
79
+ o && /* @__PURE__ */ l("div", {
80
+ className: "select-page__context",
81
+ children: o
82
+ }),
83
+ a && /* @__PURE__ */ l("p", {
40
84
  className: "select-page__eyebrow",
41
- children: u
85
+ children: a
42
86
  }),
43
- i && /* @__PURE__ */ s("h1", {
87
+ t && /* @__PURE__ */ l("h1", {
44
88
  className: "select-page__title",
45
- children: i
89
+ children: t
46
90
  }),
47
- a && /* @__PURE__ */ s("p", {
91
+ p && /* @__PURE__ */ l("div", {
92
+ className: "select-page__meta",
93
+ children: p
94
+ }),
95
+ n && /* @__PURE__ */ l("p", {
48
96
  className: "select-page__subtitle",
49
- children: a
50
- })
97
+ children: n
98
+ }),
99
+ h && E
51
100
  ]
52
101
  })]
53
- }), w && /* @__PURE__ */ c("div", {
54
- className: "select-page__actions",
55
- children: [
56
- p == null ? void 0 : p.map((t, n) => /* @__PURE__ */ s(e, {
57
- variant: "secondary",
58
- size: "sm",
59
- inline: !0,
60
- icon: t.icon,
61
- disabled: t.disabled,
62
- loading: t.loading,
63
- onClick: t.onAction,
64
- children: t.content
65
- }, n)),
66
- f && /* @__PURE__ */ s(e, {
67
- variant: "primary",
68
- size: "sm",
69
- inline: !0,
70
- icon: f.icon,
71
- disabled: f.disabled,
72
- loading: f.loading,
73
- onClick: f.onAction,
74
- children: f.content
75
- }),
76
- m
77
- ]
78
- })]
79
- }), _]
102
+ }),
103
+ !h && E,
104
+ h && /* @__PURE__ */ l("div", {
105
+ className: "select-page__aside",
106
+ children: h
107
+ })
108
+ ]
109
+ })] });
110
+ }
111
+ var g = o(function({ title: e, subtitle: t, eyebrow: n, context: r, notices: i, meta: a, aside: o, divided: s = !1, primaryAction: c, secondaryActions: d, headerActions: f, backAction: p, breadcrumbs: m, children: g, className: _, ...v }, y) {
112
+ return /* @__PURE__ */ u("div", {
113
+ ref: y,
114
+ ...v,
115
+ className: `select select-page${s ? " select-page--divided" : ""}${_ ? " " + _ : ""}`,
116
+ children: [/* @__PURE__ */ l(h, {
117
+ title: e,
118
+ subtitle: t,
119
+ eyebrow: n,
120
+ context: r,
121
+ notices: i,
122
+ meta: a,
123
+ aside: o,
124
+ primaryAction: c,
125
+ secondaryActions: d,
126
+ headerActions: f,
127
+ backAction: p,
128
+ breadcrumbs: m
129
+ }), g]
80
130
  });
81
131
  });
82
132
  //#endregion
83
- export { d as SelectPage, u as SelectPageBackProvider };
133
+ export { g as SelectPage, p as SelectPageBackProvider, h as SelectPageHeader };
84
134
 
85
135
  //# sourceMappingURL=SelectPage.js.map
@@ -8,10 +8,13 @@ declare function SkeletonThumbnail({ size }: {
8
8
  size?: 'small' | 'medium' | 'large';
9
9
  }): import("react").JSX.Element;
10
10
  /** Área de conteúdo não-textual carregando (chart, mapa, imagem, preview): retângulo
11
- * shimmer com 100% da largura do pai e a altura dada. */
12
- declare function SkeletonBlock({ height, aspectRatio }: {
11
+ * shimmer com 100% da largura do pai e a altura dada. 0.1.207: `width` (o número grande
12
+ * de um cartão, a bolha de uma conversa) e `className` (o alinhamento no pai). */
13
+ declare function SkeletonBlock({ height, aspectRatio, width, className, }: {
13
14
  height?: number | string;
14
15
  aspectRatio?: string;
16
+ width?: number | string;
17
+ className?: string;
15
18
  }): import("react").JSX.Element;
16
19
  /** Um campo de formulário carregando: o rótulo curto e a caixa do controle na altura real. */
17
20
  declare function SkeletonField({ tall }: {
@@ -23,6 +26,12 @@ declare function SkeletonRow({ media, action, boxed }: {
23
26
  action?: boolean;
24
27
  boxed?: boolean;
25
28
  }): import("react").JSX.Element;
29
+ /** As linhas de uma tabela carregando (0.1.207), fora do SelectDataTable: `columns` colunas (a primeira mais larga, a
30
+ * última à direita), `rows` linhas, os tamanhos variando de uma linha para a outra. A forma da tabela que vem. */
31
+ declare function SkeletonTable({ columns, rows }: {
32
+ columns?: number;
33
+ rows?: number;
34
+ }): import("react").JSX.Element;
26
35
  export declare const SelectSkeleton: (({ lines }: {
27
36
  lines?: number;
28
37
  }) => import("react").JSX.Element) & {
@@ -32,5 +41,6 @@ export declare const SelectSkeleton: (({ lines }: {
32
41
  Block: typeof SkeletonBlock;
33
42
  Field: typeof SkeletonField;
34
43
  Row: typeof SkeletonRow;
44
+ Table: typeof SkeletonTable;
35
45
  };
36
46
  export {};
@@ -4,19 +4,33 @@ import { jsx as e, jsxs as t } from "react/jsx-runtime";
4
4
  function n({ lines: t = 3 }) {
5
5
  return /* @__PURE__ */ e("div", {
6
6
  className: "select-skel-body",
7
+ "aria-hidden": "true",
7
8
  children: Array.from({ length: Math.max(1, t) }, (t, n) => /* @__PURE__ */ e("div", { className: "select-skeleton select-skel-line" }, n))
8
9
  });
9
10
  }
10
11
  function r({ size: t = "medium" }) {
11
- return /* @__PURE__ */ e("div", { className: `select-skeleton select-skel-display select-skel-display--${t}` });
12
+ return /* @__PURE__ */ e("div", {
13
+ className: `select-skeleton select-skel-display select-skel-display--${t}`,
14
+ "aria-hidden": "true"
15
+ });
12
16
  }
13
17
  function i({ size: t = "medium" }) {
14
- return /* @__PURE__ */ e("div", { className: `select-skeleton select-skel-thumb select-skel-thumb--${t}` });
18
+ return /* @__PURE__ */ e("div", {
19
+ className: `select-skeleton select-skel-thumb select-skel-thumb--${t}`,
20
+ "aria-hidden": "true"
21
+ });
15
22
  }
16
- function a({ height: t = 240, aspectRatio: n }) {
23
+ function a({ height: t = 240, aspectRatio: n, width: r, className: i }) {
17
24
  return /* @__PURE__ */ e("div", {
18
- className: "select-skeleton select-skel-block",
19
- style: n ? { aspectRatio: n } : { height: t }
25
+ className: `select-skeleton select-skel-block${i ? " " + i : ""}`,
26
+ style: n ? {
27
+ aspectRatio: n,
28
+ width: r
29
+ } : {
30
+ height: t,
31
+ width: r
32
+ },
33
+ "aria-hidden": "true"
20
34
  });
21
35
  }
22
36
  function o({ tall: n = !1 }) {
@@ -40,7 +54,19 @@ function s({ media: n = !0, action: r = !0, boxed: i = !1 }) {
40
54
  ]
41
55
  });
42
56
  }
43
- var c = Object.assign(function({ lines: t }) {
57
+ function c({ columns: t = 4, rows: n = 4 }) {
58
+ let r = Math.max(1, Math.floor(t)), i = { gridTemplateColumns: r === 1 ? "minmax(0, 1fr)" : `minmax(0, 2fr) repeat(${r - 1}, minmax(0, 1fr))` };
59
+ return /* @__PURE__ */ e("div", {
60
+ className: "select-skel-table",
61
+ "aria-hidden": "true",
62
+ children: Array.from({ length: Math.max(1, Math.floor(n)) }, (t, n) => /* @__PURE__ */ e("div", {
63
+ className: "select-skel-table__row",
64
+ style: i,
65
+ children: Array.from({ length: r }, (t, n) => /* @__PURE__ */ e("div", { className: "select-skeleton select-skel-table__cell" }, n))
66
+ }, n))
67
+ });
68
+ }
69
+ var l = Object.assign(function({ lines: t }) {
44
70
  return /* @__PURE__ */ e(n, { lines: t });
45
71
  }, {
46
72
  Body: n,
@@ -48,9 +74,10 @@ var c = Object.assign(function({ lines: t }) {
48
74
  Thumbnail: i,
49
75
  Block: a,
50
76
  Field: o,
51
- Row: s
77
+ Row: s,
78
+ Table: c
52
79
  });
53
80
  //#endregion
54
- export { c as SelectSkeleton };
81
+ export { l as SelectSkeleton };
55
82
 
56
83
  //# sourceMappingURL=SelectSkeleton.js.map
@@ -117,8 +117,10 @@ type SelectTableEmptyOwnProps = {
117
117
  icon?: ReactNode;
118
118
  title: ReactNode;
119
119
  subtitle?: ReactNode;
120
- /** Optional CTA below the text (e.g. "Enable Billing") — for standalone empty cards. */
120
+ /** Optional CTA below the text (e.g. "Enable Billing") — for standalone empty cards. Várias ações ficam lado a lado. */
121
121
  action?: ReactNode;
122
+ /** 0.1.207: o vazio que é um ERRO (a lista não carregou): o ícone no tom crítico. O `role="alert"` é de quem usa. */
123
+ tone?: 'critical';
122
124
  };
123
125
  export type SelectTableEmptyProps = SelectTableEmptyOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectTableEmptyOwnProps>;
124
126
  export declare const SelectTableEmpty: import('react').ForwardRefExoticComponent<SelectTableEmptyOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectTableEmptyOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
@@ -212,11 +212,11 @@ var O = l(function({ children: e, align: n = "start", disclosure: r, className:
212
212
  children: r !== "none" && /* @__PURE__ */ g(t, {})
213
213
  }) : null, e]
214
214
  });
215
- }), k = l(function({ icon: e, title: t, subtitle: n, action: r, className: i, ...a }, o) {
215
+ }), k = l(function({ icon: e, title: t, subtitle: n, action: r, tone: i, className: a, ...o }, s) {
216
216
  return /* @__PURE__ */ _("div", {
217
- ref: o,
218
- ...a,
219
- className: `select-table-empty${i ? " " + i : ""}`,
217
+ ref: s,
218
+ ...o,
219
+ className: `select-table-empty${i === "critical" ? " select-table-empty--critical" : ""}${a ? " " + a : ""}`,
220
220
  children: [
221
221
  e && /* @__PURE__ */ g("span", {
222
222
  className: "select-table-empty__icon",
package/dist/index.d.ts CHANGED
@@ -55,7 +55,7 @@ export { SelectPasswordStrength, passwordScore, type SelectPasswordRule } from '
55
55
  export { SelectLoader, type SelectLoaderProps } from './SelectLoader';
56
56
  export { SelectText } from './SelectText';
57
57
  export { SelectBox, SelectStack, SelectInline, SelectGrid } from './SelectLayout';
58
- export { SelectPage, SelectPageBackProvider } from './SelectPage';
58
+ export { SelectPage, SelectPageBackProvider, SelectPageHeader } from './SelectPage';
59
59
  export { SelectFormLayout } from './SelectFormLayout';
60
60
  export { SelectSkeleton } from './SelectSkeleton';
61
61
  export { SelectIcon } from './SelectIcon';
@@ -287,7 +287,7 @@ export type { SelectKeyValuePair, SelectKeyValueEditorProps } from './SelectKeyV
287
287
  export type { SelectBankAccount, SelectBankOption } from './SelectBankAccountField';
288
288
  export type { SelectSpace } from './spacing';
289
289
  export type { SelectTextVariant, SelectTextTone, SelectFontWeight } from './SelectText';
290
- export type { SelectPageAction, SelectPageBack } from './SelectPage';
290
+ export type { SelectPageAction, SelectPageBack, SelectPageHeaderProps } from './SelectPage';
291
291
  export type { SelectIconTone, SelectIconSize } from './SelectIcon';
292
292
  export type { SelectPlacement } from './positioning';
293
293
  export type { SelectAction, SelectActionSection } from './SelectActionList';