@selectwin/kit 0.1.201 → 0.1.202

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.
@@ -19,9 +19,10 @@ export declare function charCount(value: string, maxLength: number | undefined):
19
19
  export declare function withCount(action: ReactNode, count: ReactNode): ReactNode;
20
20
  /**
21
21
  * Os atributos nativos do `<input>` que o campo repassa (0.1.198): `inputMode`, `spellCheck`, `form`, `pattern`,
22
- * `aria-*`, `data-*`, os eventos… Os que o campo controla (o valor, o tipo, o id, a classe) ficam de fora.
22
+ * `aria-*`, `data-*`, os eventos… Os que o campo controla (o valor, o tipo, o id) ficam de fora. 0.1.202: o `className`
23
+ * SOMA às classes do `<input>` (a tela que pede a fonte larga de um código, o texto menor), sem tirar as do kit.
23
24
  */
24
- export type SelectNativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'type' | 'id' | 'className' | 'size' | 'prefix'>;
25
+ export type SelectNativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'type' | 'id' | 'size' | 'prefix'>;
25
26
  export interface SelectFieldProps {
26
27
  /** Field label. Omit when an outer row already labels the field. 0.1.198: aceita um nó. */
27
28
  label?: ReactNode;
@@ -72,7 +72,7 @@ var v = u(function({ label: e, value: a, onChange: l, type: u = "text", labelAct
72
72
  ...Z,
73
73
  ref: R,
74
74
  id: W,
75
- className: `select-input${K ? " select-input--has-suffix" : ""}${J ? " select-input--has-stepper" : ""}${ee ? " select-input--mono" : ""}${C ? " select-input--error" : ""}`,
75
+ className: `select-input${K ? " select-input--has-suffix" : ""}${J ? " select-input--has-stepper" : ""}${ee ? " select-input--mono" : ""}${C ? " select-input--error" : ""}${L != null && L.className ? " " + L.className : ""}`,
76
76
  type: de,
77
77
  value: a,
78
78
  onChange: (e) => l(e.target.value, e),
@@ -1,4 +1,4 @@
1
- import { ReactNode, ComponentPropsWithoutRef } from 'react';
1
+ import { ChangeEvent, InputHTMLAttributes, ReactNode, ComponentPropsWithoutRef } from 'react';
2
2
  export interface SelectRadioOption {
3
3
  value: string;
4
4
  label: ReactNode;
@@ -9,6 +9,25 @@ export interface SelectRadioOption {
9
9
  trailing?: ReactNode;
10
10
  disabled?: boolean;
11
11
  }
12
+ export type SelectRadioCardProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'onChange'> & {
13
+ label: ReactNode;
14
+ description?: ReactNode;
15
+ leading?: ReactNode;
16
+ trailing?: ReactNode;
17
+ /** Marcado (o cartão acende). Sem `checked`, o rádio fica por conta do navegador (`defaultChecked`). */
18
+ checked?: boolean;
19
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
20
+ };
21
+ /** O cartão de uma opção, com o rádio de verdade dentro: o nome do grupo, o valor e o resto do `<input>` passam. */
22
+ export declare const SelectRadioCard: import('react').ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "onChange"> & {
23
+ label: ReactNode;
24
+ description?: ReactNode;
25
+ leading?: ReactNode;
26
+ trailing?: ReactNode;
27
+ /** Marcado (o cartão acende). Sem `checked`, o rádio fica por conta do navegador (`defaultChecked`). */
28
+ checked?: boolean;
29
+ onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
30
+ } & import('react').RefAttributes<HTMLInputElement>>;
12
31
  type SelectRadioGroupOwnProps = {
13
32
  value: string;
14
33
  onChange: (value: string) => void;
@@ -1,54 +1,63 @@
1
1
  import { forwardRef as e, useId as t } from "react";
2
2
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
3
  //#region src/SelectRadioGroup.tsx
4
- var i = e(function({ value: e, onChange: i, options: a, name: o, className: s, ...c }, l) {
4
+ var i = e(function({ label: e, description: t, leading: i, trailing: a, checked: o, disabled: s, className: c, onChange: l, ...u }, d) {
5
+ return /* @__PURE__ */ r("label", {
6
+ className: `select-radio${o ? " select-radio--selected" : ""}${s ? " select-radio--disabled" : ""}${c ? " " + c : ""}`,
7
+ children: [
8
+ /* @__PURE__ */ n("input", {
9
+ ref: d,
10
+ ...u,
11
+ type: "radio",
12
+ checked: o,
13
+ disabled: s,
14
+ onChange: l
15
+ }),
16
+ /* @__PURE__ */ n("span", {
17
+ className: "select-radio__dot",
18
+ "aria-hidden": "true"
19
+ }),
20
+ i && /* @__PURE__ */ n("span", {
21
+ className: "select-radio__leading",
22
+ children: i
23
+ }),
24
+ /* @__PURE__ */ r("span", {
25
+ className: "select-radio__text",
26
+ children: [/* @__PURE__ */ n("span", {
27
+ className: "select-radio__label",
28
+ children: e
29
+ }), t && /* @__PURE__ */ n("span", {
30
+ className: "select-radio__desc",
31
+ children: t
32
+ })]
33
+ }),
34
+ a && /* @__PURE__ */ n("span", {
35
+ className: "select-radio__trailing",
36
+ children: a
37
+ })
38
+ ]
39
+ });
40
+ }), a = e(function({ value: e, onChange: r, options: a, name: o, className: s, ...c }, l) {
5
41
  let u = t(), d = o ?? u;
6
42
  return /* @__PURE__ */ n("div", {
7
43
  ref: l,
8
44
  ...c,
9
45
  className: `select-radiogroup${s ? " " + s : ""}`,
10
46
  role: "radiogroup",
11
- children: a.map((t) => {
12
- let a = t.value === e;
13
- return /* @__PURE__ */ r("label", {
14
- className: `select-radio${a ? " select-radio--selected" : ""}${t.disabled ? " select-radio--disabled" : ""}`,
15
- children: [
16
- /* @__PURE__ */ n("input", {
17
- type: "radio",
18
- name: d,
19
- value: t.value,
20
- checked: a,
21
- disabled: t.disabled,
22
- onChange: () => i(t.value)
23
- }),
24
- /* @__PURE__ */ n("span", {
25
- className: "select-radio__dot",
26
- "aria-hidden": "true"
27
- }),
28
- t.leading && /* @__PURE__ */ n("span", {
29
- className: "select-radio__leading",
30
- children: t.leading
31
- }),
32
- /* @__PURE__ */ r("span", {
33
- className: "select-radio__text",
34
- children: [/* @__PURE__ */ n("span", {
35
- className: "select-radio__label",
36
- children: t.label
37
- }), t.description && /* @__PURE__ */ n("span", {
38
- className: "select-radio__desc",
39
- children: t.description
40
- })]
41
- }),
42
- t.trailing && /* @__PURE__ */ n("span", {
43
- className: "select-radio__trailing",
44
- children: t.trailing
45
- })
46
- ]
47
- }, t.value);
48
- })
47
+ children: a.map((t) => /* @__PURE__ */ n(i, {
48
+ name: d,
49
+ value: t.value,
50
+ checked: t.value === e,
51
+ disabled: t.disabled,
52
+ onChange: () => r(t.value),
53
+ label: t.label,
54
+ description: t.description,
55
+ leading: t.leading,
56
+ trailing: t.trailing
57
+ }, t.value))
49
58
  });
50
59
  });
51
60
  //#endregion
52
- export { i as SelectRadioGroup };
61
+ export { i as SelectRadioCard, a as SelectRadioGroup };
53
62
 
54
63
  //# sourceMappingURL=SelectRadioGroup.js.map
@@ -13,6 +13,8 @@ type SelectSearchInputOwnProps = {
13
13
  inputProps?: SelectNativeInputProps;
14
14
  /** 0.1.198: a referência do `<input>`. */
15
15
  inputRef?: Ref<HTMLInputElement>;
16
+ /** 0.1.202: a densidade, como nos outros campos (`sm` nas barras de filtro e no seletor de workspace). */
17
+ size?: 'sm' | 'md';
16
18
  };
17
19
  export type SelectSearchInputProps = SelectSearchInputOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectSearchInputOwnProps>;
18
20
  export declare const SelectSearchInput: import('react').ForwardRefExoticComponent<SelectSearchInputOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectSearchInputOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
@@ -4,12 +4,12 @@ import { useSelectMessages as n } from "./SelectLocale.js";
4
4
  import { forwardRef as r } from "react";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  //#region src/SelectSearchInput.tsx
7
- var o = r(function({ value: r, onChange: o, placeholder: s, shortcut: c, inputLabel: l, inputProps: u, inputRef: d, className: f, ...p }, m) {
8
- let h = n().common.searchPlaceholder, g = s ?? h, _ = t(u, { placeholder: g });
7
+ var o = r(function({ value: r, onChange: o, placeholder: s, shortcut: c, inputLabel: l, inputProps: u, inputRef: d, size: f = "md", className: p, ...m }, h) {
8
+ let g = n().common.searchPlaceholder, _ = s ?? g, v = t(u, { placeholder: _ });
9
9
  return /* @__PURE__ */ a("div", {
10
- ref: m,
11
- ...p,
12
- className: `select-search${f ? " " + f : ""}`,
10
+ ref: h,
11
+ ...m,
12
+ className: `select-search${f === "sm" ? " select-search--sm" : ""}${p ? " " + p : ""}`,
13
13
  children: [
14
14
  /* @__PURE__ */ i("span", {
15
15
  className: "select-search__icon",
@@ -17,13 +17,13 @@ var o = r(function({ value: r, onChange: o, placeholder: s, shortcut: c, inputLa
17
17
  children: /* @__PURE__ */ i(e, {})
18
18
  }),
19
19
  /* @__PURE__ */ i("input", {
20
- ..._,
20
+ ...v,
21
21
  ref: d,
22
- className: "select-search__input",
22
+ className: `select-search__input${u != null && u.className ? " " + u.className : ""}`,
23
23
  type: "search",
24
24
  value: r,
25
25
  onChange: (e) => o(e.target.value, e),
26
- "aria-label": l ?? _["aria-label"] ?? g
26
+ "aria-label": l ?? v["aria-label"] ?? _
27
27
  }),
28
28
  c && /* @__PURE__ */ i("kbd", {
29
29
  className: "select-search__kbd",
@@ -17,7 +17,7 @@ type SelectSelectOwnProps = {
17
17
  /** 0.1.198: o "(opcional)" depois do rótulo. */
18
18
  optional?: boolean;
19
19
  /** 0.1.198: os atributos nativos do `<select>` (o `form`, o `autoFocus`, o `aria-*`…). */
20
- selectProps?: Omit<SelectHTMLAttributes<HTMLSelectElement>, 'value' | 'defaultValue' | 'onChange' | 'id' | 'className' | 'children'>;
20
+ selectProps?: Omit<SelectHTMLAttributes<HTMLSelectElement>, 'value' | 'defaultValue' | 'onChange' | 'id' | 'children'>;
21
21
  /** 0.1.198: a referência do `<select>`. */
22
22
  selectRef?: Ref<HTMLSelectElement>;
23
23
  /** 0.1.198: o id do `<select>` (um rótulo de fora aponta para ele). */
@@ -45,7 +45,7 @@ var u = o(function({ label: o, value: u, onChange: d, options: f = [], children:
45
45
  ...L,
46
46
  ref: O,
47
47
  id: F,
48
- className: `select-input select-select${y ? " select-input--error" : ""}`,
48
+ className: `select-input select-select${y ? " select-input--error" : ""}${D != null && D.className ? " " + D.className : ""}`,
49
49
  value: u,
50
50
  onChange: (e) => d(e.target.value, e),
51
51
  "aria-invalid": y ? !0 : L["aria-invalid"],
@@ -8,7 +8,7 @@ type SelectTextareaOwnProps = {
8
8
  /** 0.1.198: o "(opcional)" depois do rótulo. */
9
9
  optional?: boolean;
10
10
  /** 0.1.198: os atributos nativos da `<textarea>` (o `spellCheck`, o `readOnly`, o `autoFocus`, o `aria-*`…). */
11
- textareaProps?: Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue' | 'onChange' | 'id' | 'className'>;
11
+ textareaProps?: Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue' | 'onChange' | 'id'>;
12
12
  /** 0.1.198: a referência da `<textarea>`. */
13
13
  textareaRef?: Ref<HTMLTextAreaElement>;
14
14
  /** 0.1.198: o id da `<textarea>` (um rótulo de fora aponta para ele). */
@@ -34,7 +34,7 @@ var l = a(function({ label: a, value: l, onChange: u, labelAction: d, help: f, i
34
34
  ...R,
35
35
  ref: k,
36
36
  id: F,
37
- className: `select-input select-textarea${y ? " select-textarea--mono" : ""}${g ? " select-input--error" : ""}`,
37
+ className: `select-input select-textarea${y ? " select-textarea--mono" : ""}${g ? " select-input--error" : ""}${O != null && O.className ? " " + O.className : ""}`,
38
38
  value: l,
39
39
  onChange: (e) => u(e.target.value, e),
40
40
  "aria-invalid": g ? !0 : R["aria-invalid"],
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { SelectToggleList, SelectToggleRow } from './SelectToggle';
23
23
  export { SelectTogglePanel } from './SelectTogglePanel';
24
24
  export { SelectSelect } from './SelectSelect';
25
25
  export { SelectPhoneField, SELECT_COUNTRIES, dialCodeOf } from './SelectPhoneField';
26
- export { SelectRadioGroup } from './SelectRadioGroup';
26
+ export { SelectRadioCard, SelectRadioGroup, type SelectRadioCardProps } from './SelectRadioGroup';
27
27
  export { SelectSegmented } from './SelectSegmented';
28
28
  export { SelectBadge } from './SelectBadge';
29
29
  export { SelectStatusBadge, SELECT_TRANSACTION_STATUS } from './SelectStatusBadge';