@seedgrid/fe-components 2026.9.2 → 2026.9.3
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.
- package/dist/ai/seedgrid-components.manifest.json +4 -4
- package/dist/inputs/SgMultiSelect.meta.js +1 -1
- package/dist/inputs/SgMultiSelectChips.d.ts.map +1 -1
- package/dist/inputs/SgMultiSelectChips.js +1 -1
- package/dist/inputs/SgMultiSelectChips.meta.js +1 -1
- package/dist/inputs/useSgMultiSelect.d.ts +6 -0
- package/dist/inputs/useSgMultiSelect.d.ts.map +1 -1
- package/dist/inputs/useSgMultiSelect.js +4 -1
- package/dist/sandbox.cjs +15 -15
- package/package.json +2 -2
|
@@ -1796,9 +1796,9 @@
|
|
|
1796
1796
|
},
|
|
1797
1797
|
{
|
|
1798
1798
|
"name": "options",
|
|
1799
|
-
"type": "{ label: string; value: string | number; disabled?: boolean }[]",
|
|
1799
|
+
"type": "{ label: string; value: string | number; chipLabel?: string; disabled?: boolean }[]",
|
|
1800
1800
|
"required": true,
|
|
1801
|
-
"description": "Lista de opcoes disponiveis.",
|
|
1801
|
+
"description": "Lista de opcoes disponiveis. `label` aparece na lista; `chipLabel` (opcional) e' o texto curto do item ja' selecionado (o resumo do campo), ex.: label \"3 - Filial Centro\" e chipLabel \"3\".",
|
|
1802
1802
|
"semanticRole": "data",
|
|
1803
1803
|
"bindable": false
|
|
1804
1804
|
},
|
|
@@ -2132,9 +2132,9 @@
|
|
|
2132
2132
|
},
|
|
2133
2133
|
{
|
|
2134
2134
|
"name": "options",
|
|
2135
|
-
"type": "{ label: string; value: string | number; disabled?: boolean }[]",
|
|
2135
|
+
"type": "{ label: string; value: string | number; chipLabel?: string; disabled?: boolean }[]",
|
|
2136
2136
|
"required": true,
|
|
2137
|
-
"description": "Lista de opcoes disponiveis.",
|
|
2137
|
+
"description": "Lista de opcoes disponiveis. `label` aparece na lista; `chipLabel` (opcional) e' o texto curto do item ja' selecionado (o chip), ex.: label \"3 - Filial Centro\" e chipLabel \"3\".",
|
|
2138
2138
|
"semanticRole": "data",
|
|
2139
2139
|
"bindable": false
|
|
2140
2140
|
},
|
|
@@ -14,7 +14,7 @@ export const sgMeta = {
|
|
|
14
14
|
props: [
|
|
15
15
|
{ name: "id", type: "string", required: true, description: "Identificador unico do campo.", semanticRole: "data", bindable: false },
|
|
16
16
|
{ name: "label", type: "string", description: "Rotulo exibido ao usuario.", semanticRole: "label", bindable: true },
|
|
17
|
-
{ name: "options", type: "{ label: string; value: string | number; disabled?: boolean }[]", description: "Lista de opcoes disponiveis.", semanticRole: "data", bindable: false },
|
|
17
|
+
{ name: "options", type: "{ label: string; value: string | number; chipLabel?: string; disabled?: boolean }[]", description: "Lista de opcoes disponiveis. `label` aparece na lista; `chipLabel` (opcional) e' o texto curto do item ja' selecionado (o resumo do campo), ex.: label \"3 - Filial Centro\" e chipLabel \"3\".", semanticRole: "data", bindable: false },
|
|
18
18
|
{ name: "value", type: "(string | number)[]", description: "Array de valores selecionados.", semanticRole: "value", bindable: true },
|
|
19
19
|
{ name: "onChange", type: "(value: (string | number)[]) => void", description: "Callback com o array atualizado de valores.", semanticRole: "event", bindable: false },
|
|
20
20
|
{ name: "searchable", type: "boolean", default: false, description: "Exibe campo de busca no topo do dropdown.", semanticRole: "behavior", bindable: true },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgMultiSelectChips.d.ts","sourceRoot":"","sources":["../../src/inputs/SgMultiSelectChips.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAI/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAExF,YAAY,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAExF,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAA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EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,KAAK,IAAI,CAAC;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AA8PF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,2CAsB1E"}
|
|
@@ -100,7 +100,7 @@ function SgMultiSelectChipsBase(props) {
|
|
|
100
100
|
ms.handleListKeyDown(event);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
}, children: [_jsx("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: ms.selectedOptions.length === 0 ? (_jsx("span", { className: "px-1 text-[var(--sg-input-placeholder,hsl(var(--muted-foreground)))]", children: resolvedPlaceholder })) : (ms.selectedOptions.map((option) => (_jsxs("span", { className: "inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted/60 py-0.5 pl-2 pr-1 text-xs text-foreground", children: [_jsx("span", { className: "truncate", children: option.label }), !isDisabled ? (_jsx("button", { type: "button", "data-sg-chip-remove": "true", tabIndex: -1, className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-foreground/60 hover:bg-foreground/10 hover:text-foreground", onMouseDown: (event) => {
|
|
103
|
+
}, children: [_jsx("div", { className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5", children: ms.selectedOptions.length === 0 ? (_jsx("span", { className: "px-1 text-[var(--sg-input-placeholder,hsl(var(--muted-foreground)))]", children: resolvedPlaceholder })) : (ms.selectedOptions.map((option) => (_jsxs("span", { className: "inline-flex max-w-full items-center gap-1 rounded-full border border-border bg-muted/60 py-0.5 pl-2 pr-1 text-xs text-foreground", children: [_jsx("span", { className: "truncate", title: option.chipLabel !== undefined ? option.label : undefined, children: option.chipLabel ?? option.label }), !isDisabled ? (_jsx("button", { type: "button", "data-sg-chip-remove": "true", tabIndex: -1, className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-foreground/60 hover:bg-foreground/10 hover:text-foreground", onMouseDown: (event) => {
|
|
104
104
|
event.preventDefault();
|
|
105
105
|
event.stopPropagation();
|
|
106
106
|
ms.ignoreBlurRef.current = true;
|
|
@@ -14,7 +14,7 @@ export const sgMeta = {
|
|
|
14
14
|
props: [
|
|
15
15
|
{ name: "id", type: "string", required: true, description: "Identificador unico do campo.", semanticRole: "data", bindable: false },
|
|
16
16
|
{ name: "label", type: "string", description: "Rotulo exibido ao usuario.", semanticRole: "label", bindable: true },
|
|
17
|
-
{ name: "options", type: "{ label: string; value: string | number; disabled?: boolean }[]", description: "Lista de opcoes disponiveis.", semanticRole: "data", bindable: false },
|
|
17
|
+
{ name: "options", type: "{ label: string; value: string | number; chipLabel?: string; disabled?: boolean }[]", description: "Lista de opcoes disponiveis. `label` aparece na lista; `chipLabel` (opcional) e' o texto curto do item ja' selecionado (o chip), ex.: label \"3 - Filial Centro\" e chipLabel \"3\".", semanticRole: "data", bindable: false },
|
|
18
18
|
{ name: "value", type: "(string | number)[]", description: "Array de valores selecionados.", semanticRole: "value", bindable: true },
|
|
19
19
|
{ name: "onChange", type: "(value: (string | number)[]) => void", description: "Callback com o array atualizado de valores.", semanticRole: "event", bindable: false },
|
|
20
20
|
{ name: "searchable", type: "boolean", default: false, description: "Exibe campo de busca no topo do dropdown.", semanticRole: "behavior", bindable: true },
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type SgMultiSelectOptionValue = string | number;
|
|
3
3
|
export type SgMultiSelectOption = {
|
|
4
|
+
/** Texto da lista (e o que a busca procura). */
|
|
4
5
|
label: string;
|
|
5
6
|
value: SgMultiSelectOptionValue;
|
|
7
|
+
/**
|
|
8
|
+
* Texto curto do item JA selecionado: o chip do SgMultiSelectChips e o resumo do SgMultiSelect.
|
|
9
|
+
* Sem ele, vale o `label`. Ex.: `label: "3 - Filial Centro"`, `chipLabel: "3"`.
|
|
10
|
+
*/
|
|
11
|
+
chipLabel?: string;
|
|
6
12
|
disabled?: boolean;
|
|
7
13
|
};
|
|
8
14
|
export declare function valueEquals(left: SgMultiSelectOptionValue, right: SgMultiSelectOptionValue): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSgMultiSelect.d.ts","sourceRoot":"","sources":["../../src/inputs/useSgMultiSelect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,wBAAwB,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,wBAAwB,WAE1F;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACnC,QAAQ,CAAC,EA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;;;uCAyB7C,wBAAwB;oCAgD7B,mBAAmB;wCAgBd,wBAAwB;;;;wCA4E9B,KAAK,CAAC,aAAa;EAiE9B"}
|
|
@@ -37,7 +37,10 @@ export function useSgMultiSelect(params) {
|
|
|
37
37
|
}, [options, query, searchable]);
|
|
38
38
|
const selectedLabels = React.useMemo(() => {
|
|
39
39
|
return resolvedValue
|
|
40
|
-
.map((entry) =>
|
|
40
|
+
.map((entry) => {
|
|
41
|
+
const option = options.find((candidate) => valueEquals(candidate.value, entry));
|
|
42
|
+
return option ? (option.chipLabel ?? option.label) : undefined;
|
|
43
|
+
})
|
|
41
44
|
.filter((label) => Boolean(label));
|
|
42
45
|
}, [options, resolvedValue]);
|
|
43
46
|
const selectedOptions = React.useMemo(() => {
|