@strategicos/ui 0.7.0 → 0.8.0

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/README.md CHANGED
@@ -15,7 +15,7 @@ import { cn } from "@strategicos/ui/utils"
15
15
 
16
16
  ## Componentes
17
17
 
18
- `accordion` · `alert` · `alert-dialog` · `avatar` · `badge` · `breadcrumb` · `button` · `card` · `checkbox` · `chip` · `dialog` · `dropdown-menu` · `dropzone` · `empty-state` · `field` · `input` · `label` · `multi-select` · `page-header` · `pagination` · `password-input` · `popover` · `progress` · `segmented-control` · `select` · `separator` · `sheet` · `sidebar` · `skeleton` · `sonner` · `stat` · `switch` · `table` · `tabs` · `textarea` · `tooltip`
18
+ `accordion` · `alert` · `alert-dialog` · `avatar` · `badge` · `breadcrumb` · `button` · `calendar` · `card` · `checkbox` · `chip` · `combobox` · `date-picker` · `dialog` · `dropdown-menu` · `dropzone` · `empty-state` · `field` · `input` · `label` · `multi-select` · `page-header` · `pagination` · `password-input` · `popover` · `progress` · `segmented-control` · `select` · `separator` · `sheet` · `sidebar` · `skeleton` · `sonner` · `stat` · `switch` · `table` · `tabs` · `textarea` · `tooltip`
19
19
 
20
20
  Utilitários: `@strategicos/ui/utils` (`cn`) e `@strategicos/ui/hooks/use-mobile` (`useIsMobile`).
21
21
 
@@ -31,7 +31,7 @@ Botões de ícone: `icon-xs` 24px, `icon-sm` 30px, `icon` 36px, `icon-lg` 42px.
31
31
 
32
32
  ## Formulários
33
33
 
34
- `Field` monta rótulo, descrição, controle e erro, e liga tudo ao controle de dentro (`id`, `aria-describedby`, `aria-invalid`, `required`). Funciona com `Input`, `PasswordInput`, `Textarea` e `SelectTrigger`.
34
+ `Field` monta rótulo, descrição, controle e erro, e liga tudo ao controle de dentro (`id`, `aria-describedby`, `aria-invalid`, `required`). Funciona com `Input`, `PasswordInput`, `Textarea`, `SelectTrigger`, `MultiSelect`, `Combobox`, `DatePicker` e `DateRangePicker`.
35
35
 
36
36
  ```tsx
37
37
  import { Field } from "@strategicos/ui/field"
@@ -45,6 +45,37 @@ import { Input } from "@strategicos/ui/input"
45
45
  - `Input` aceita `leftSection` e `rightSection` (ícones ou botões dentro do campo). Quando há seção, use `wrapperClassName` para largura e posição.
46
46
  - `PasswordInput` traz o botão de mostrar/ocultar a senha.
47
47
  - `Textarea autosize` cresce com o texto. Limite a altura com `max-h-*`.
48
+ - Gatilho próprio (um Popover que abre uma lista, por exemplo)? Use `selectTriggerVariants({ size })` de `@strategicos/ui/select` em vez de copiar as classes; marque `data-placeholder` quando estiver vazio.
49
+
50
+ ### Combobox
51
+
52
+ Seleção de um item com busca. Pode criar e excluir opções ali mesmo:
53
+
54
+ ```tsx
55
+ <Combobox
56
+ options={setores.map(s => ({ value: s.id, label: s.name }))}
57
+ value={setorId}
58
+ onValueChange={setSetorId}
59
+ clearable
60
+ onCreate={async nome => (await criarSetor(nome)).id}
61
+ onRemove={async s => excluirSetor(s.value)}
62
+ />
63
+ ```
64
+
65
+ `onCreate` aparece como "Criar “texto”" quando a busca não bate com nenhuma opção; o valor devolvido fica selecionado. `onRemove` põe um X em cada opção e confirma na própria linha. Erro nessas funções aparece no rodapé da lista.
66
+
67
+ ### Datas
68
+
69
+ `DatePicker` e `DateRangePicker` trabalham com `"AAAA-MM-DD"` (como o `<input type="date">` e o Mantine 8), nunca com `Date`, para não haver erro de fuso. `parseDateValue` e `toDateValue` convertem quando precisar.
70
+
71
+ ```tsx
72
+ <DatePicker value={prazo} onValueChange={setPrazo} minDate={inicio} maxDate={fimDoEixo} clearable />
73
+ <DateRangePicker value={[inicio, fim]} onValueChange={([i, f]) => salvar(i, f)} />
74
+ ```
75
+
76
+ - `presets`: atalhos ao lado do calendário (`{ label: "Fim do mês", value: "2026-10-31" }`).
77
+ - `captionLayout="dropdown"`: seletores de mês e ano, para datas distantes.
78
+ - `Calendar` é o calendário solto (react-day-picker), em português e com a semana começando no domingo.
48
79
 
49
80
  ## Quando usar cada um
50
81
 
@@ -53,7 +84,10 @@ import { Input } from "@strategicos/ui/input"
53
84
  | Trocar o modo de ver o mesmo conteúdo (Lista \| Quadro, 30d \| 60d) | `SegmentedControl` |
54
85
  | Navegar entre conteúdos diferentes | `Tabs` |
55
86
  | Filtros em pílula (categoria, status), um ou vários | `ChipGroup` + `Chip` |
87
+ | Escolher um item de poucas opções | `Select` |
88
+ | Escolher um item com busca, ou criando/excluindo opções | `Combobox` |
56
89
  | Escolher vários itens com busca | `MultiSelect` |
90
+ | Uma data / um período | `DatePicker` / `DateRangePicker` |
57
91
  | Indicador numérico (KPI) | `Stat` |
58
92
  | Barra de progresso | `Progress` |
59
93
  | Área de envio de arquivos | `Dropzone` |
@@ -25,3 +25,190 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
27
  ```
28
+
29
+ ## Tremor
30
+
31
+ `calendar.tsx` e `date-picker.tsx` são derivados do Calendar e do DatePicker do [Tremor](https://github.com/tremorlabs/tremor) (`src/components/Calendar/Calendar.tsx` e `src/components/DatePicker/DatePicker.tsx`), distribuídos sob a Apache License 2.0.
32
+
33
+ Modificações feitas pela Strategicos: migração para o react-day-picker v10; estilos trocados pelos tokens do `@strategicos/tokens`; valores em `"AAAA-MM-DD"` em vez de `Date`; escolha do dia fecha o calendário (sem os botões Cancelar/Aplicar); seleção de período em dois cliques controlada pelo componente; remoção do seletor de hora; integração com o `Field`; textos em português.
34
+
35
+ O Tremor, por sua vez, contém partes do shadcn/ui, do Radix Themes e do Medusa UI, sob a licença MIT.
36
+
37
+ ```
38
+ Apache License
39
+ Version 2.0, January 2004
40
+ http://www.apache.org/licenses/
41
+
42
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
43
+
44
+ 1. Definitions.
45
+
46
+ "License" shall mean the terms and conditions for use, reproduction,
47
+ and distribution as defined by Sections 1 through 9 of this document.
48
+
49
+ "Licensor" shall mean the copyright owner or entity authorized by
50
+ the copyright owner that is granting the License.
51
+
52
+ "Legal Entity" shall mean the union of the acting entity and all
53
+ other entities that control, are controlled by, or are under common
54
+ control with that entity. For the purposes of this definition,
55
+ "control" means (i) the power, direct or indirect, to cause the
56
+ direction or management of such entity, whether by contract or
57
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
58
+ outstanding shares, or (iii) beneficial ownership of such entity.
59
+
60
+ "You" (or "Your") shall mean an individual or Legal Entity
61
+ exercising permissions granted by this License.
62
+
63
+ "Source" form shall mean the preferred form for making modifications,
64
+ including but not limited to software source code, documentation
65
+ source, and configuration files.
66
+
67
+ "Object" form shall mean any form resulting from mechanical
68
+ transformation or translation of a Source form, including but
69
+ not limited to compiled object code, generated documentation,
70
+ and conversions to other media types.
71
+
72
+ "Work" shall mean the work of authorship, whether in Source or
73
+ Object form, made available under the License, as indicated by a
74
+ copyright notice that is included in or attached to the work
75
+ (an example is provided in the Appendix below).
76
+
77
+ "Derivative Works" shall mean any work, whether in Source or Object
78
+ form, that is based on (or derived from) the Work and for which the
79
+ editorial revisions, annotations, elaborations, or other modifications
80
+ represent, as a whole, an original work of authorship. For the purposes
81
+ of this License, Derivative Works shall not include works that remain
82
+ separable from, or merely link (or bind by name) to the interfaces of,
83
+ the Work and Derivative Works thereof.
84
+
85
+ "Contribution" shall mean any work of authorship, including
86
+ the original version of the Work and any modifications or additions
87
+ to that Work or Derivative Works thereof, that is intentionally
88
+ submitted to Licensor for inclusion in the Work by the copyright owner
89
+ or by an individual or Legal Entity authorized to submit on behalf of
90
+ the copyright owner. For the purposes of this definition, "submitted"
91
+ means any form of electronic, verbal, or written communication sent
92
+ to the Licensor or its representatives, including but not limited to
93
+ communication on electronic mailing lists, source code control systems,
94
+ and issue tracking systems that are managed by, or on behalf of, the
95
+ Licensor for the purpose of discussing and improving the Work, but
96
+ excluding communication that is conspicuously marked or otherwise
97
+ designated in writing by the copyright owner as "Not a Contribution."
98
+
99
+ "Contributor" shall mean Licensor and any individual or Legal Entity
100
+ on behalf of whom a Contribution has been received by Licensor and
101
+ subsequently incorporated within the Work.
102
+
103
+ 2. Grant of Copyright License. Subject to the terms and conditions of
104
+ this License, each Contributor hereby grants to You a perpetual,
105
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
106
+ copyright license to reproduce, prepare Derivative Works of,
107
+ publicly display, publicly perform, sublicense, and distribute the
108
+ Work and such Derivative Works in Source or Object form.
109
+
110
+ 3. Grant of Patent License. Subject to the terms and conditions of
111
+ this License, each Contributor hereby grants to You a perpetual,
112
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
113
+ (except as stated in this section) patent license to make, have made,
114
+ use, offer to sell, sell, import, and otherwise transfer the Work,
115
+ where such license applies only to those patent claims licensable
116
+ by such Contributor that are necessarily infringed by their
117
+ Contribution(s) alone or by combination of their Contribution(s)
118
+ with the Work to which such Contribution(s) was submitted. If You
119
+ institute patent litigation against any entity (including a
120
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
121
+ or a Contribution incorporated within the Work constitutes direct
122
+ or contributory patent infringement, then any patent licenses
123
+ granted to You under this License for that Work shall terminate
124
+ as of the date such litigation is filed.
125
+
126
+ 4. Redistribution. You may reproduce and distribute copies of the
127
+ Work or Derivative Works thereof in any medium, with or without
128
+ modifications, and in Source or Object form, provided that You
129
+ meet the following conditions:
130
+
131
+ (a) You must give any other recipients of the Work or
132
+ Derivative Works a copy of this License; and
133
+
134
+ (b) You must cause any modified files to carry prominent notices
135
+ stating that You changed the files; and
136
+
137
+ (c) You must retain, in the Source form of any Derivative Works
138
+ that You distribute, all copyright, patent, trademark, and
139
+ attribution notices from the Source form of the Work,
140
+ excluding those notices that do not pertain to any part of
141
+ the Derivative Works; and
142
+
143
+ (d) If the Work includes a "NOTICE" text file as part of its
144
+ distribution, then any Derivative Works that You distribute must
145
+ include a readable copy of the attribution notices contained
146
+ within such NOTICE file, excluding those notices that do not
147
+ pertain to any part of the Derivative Works, in at least one
148
+ of the following places: within a NOTICE text file distributed
149
+ as part of the Derivative Works; within the Source form or
150
+ documentation, if provided along with the Derivative Works; or,
151
+ within a display generated by the Derivative Works, if and
152
+ wherever such third-party notices normally appear. The contents
153
+ of the NOTICE file are for informational purposes only and
154
+ do not modify the License. You may add Your own attribution
155
+ notices within Derivative Works that You distribute, alongside
156
+ or as an addendum to the NOTICE text from the Work, provided
157
+ that such additional attribution notices cannot be construed
158
+ as modifying the License.
159
+
160
+ You may add Your own copyright statement to Your modifications and
161
+ may provide additional or different license terms and conditions
162
+ for use, reproduction, or distribution of Your modifications, or
163
+ for any such Derivative Works as a whole, provided Your use,
164
+ reproduction, and distribution of the Work otherwise complies with
165
+ the conditions stated in this License.
166
+
167
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
168
+ any Contribution intentionally submitted for inclusion in the Work
169
+ by You to the Licensor shall be under the terms and conditions of
170
+ this License, without any additional terms or conditions.
171
+ Notwithstanding the above, nothing herein shall supersede or modify
172
+ the terms of any separate license agreement you may have executed
173
+ with Licensor regarding such Contributions.
174
+
175
+ 6. Trademarks. This License does not grant permission to use the trade
176
+ names, trademarks, service marks, or product names of the Licensor,
177
+ except as required for reasonable and customary use in describing the
178
+ origin of the Work and reproducing the content of the NOTICE file.
179
+
180
+ 7. Disclaimer of Warranty. Unless required by applicable law or
181
+ agreed to in writing, Licensor provides the Work (and each
182
+ Contributor provides its Contributions) on an "AS IS" BASIS,
183
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
184
+ implied, including, without limitation, any warranties or conditions
185
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
186
+ PARTICULAR PURPOSE. You are solely responsible for determining the
187
+ appropriateness of using or redistributing the Work and assume any
188
+ risks associated with Your exercise of permissions under this License.
189
+
190
+ 8. Limitation of Liability. In no event and under no legal theory,
191
+ whether in tort (including negligence), contract, or otherwise,
192
+ unless required by applicable law (such as deliberate and grossly
193
+ negligent acts) or agreed to in writing, shall any Contributor be
194
+ liable to You for damages, including any direct, indirect, special,
195
+ incidental, or consequential damages of any character arising as a
196
+ result of this License or out of the use or inability to use the
197
+ Work (including but not limited to damages for loss of goodwill,
198
+ work stoppage, computer failure or malfunction, or any and all
199
+ other commercial damages or losses), even if such Contributor
200
+ has been advised of the possibility of such damages.
201
+
202
+ 9. Accepting Warranty or Additional Liability. While redistributing
203
+ the Work or Derivative Works thereof, You may choose to offer,
204
+ and charge a fee for, acceptance of support, warranty, indemnity,
205
+ or other liability obligations and/or rights consistent with this
206
+ License. However, in accepting such obligations, You may act only
207
+ on Your own behalf and on Your sole responsibility, not on behalf
208
+ of any other Contributor, and only if You agree to indemnify,
209
+ defend, and hold each Contributor harmless for any liability
210
+ incurred by, or claims asserted against, such Contributor by reason
211
+ of your accepting any such warranty or additional liability.
212
+
213
+ END OF TERMS AND CONDITIONS
214
+ ```
@@ -0,0 +1,24 @@
1
+ import * as React from "react";
2
+ import { DayPicker, type DayButtonProps } from "react-day-picker";
3
+ /**
4
+ * Calendário (react-day-picker), com o desenho do Calendar do Tremor nos tokens
5
+ * do kit. É a peça de dentro do DatePicker; use solto quando o calendário fica
6
+ * aberto na tela.
7
+ *
8
+ * <Calendar mode="single" selected={dia} onSelect={setDia} />
9
+ *
10
+ * Padrões: português do Brasil (semana começando no domingo) e dias de fora do
11
+ * mês visíveis. `captionLayout="dropdown"` troca o título por seletores de mês
12
+ * e ano — útil para datas distantes, como nascimento. Aceita todas as props do
13
+ * DayPicker.
14
+ */
15
+ declare function Calendar({ className, classNames, captionLayout, showOutsideDays, locale, components, ...props }: React.ComponentProps<typeof DayPicker>): React.JSX.Element;
16
+ /** Dia do calendário. Os estados viram data-* para o estilo, e "hoje" ganha o
17
+ * traço embaixo do número, como no Tremor.
18
+ *
19
+ * O dia escolhido é `data-picked`, e não `data-selected-*`: o styles.css
20
+ * registra a variante `data-selected`, e o Tailwind lê `data-selected-x:` como
21
+ * essa variante com um valor — a classe é descartada sem aviso. */
22
+ declare function CalendarDayButton({ className, day, modifiers, children, ...props }: DayButtonProps): React.JSX.Element;
23
+ export { Calendar, CalendarDayButton };
24
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAMjE;;;;;;;;;;;GAWG;AACH,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,UAAU,EACV,aAAuB,EACvB,eAAsB,EACtB,MAAa,EACb,UAAU,EACV,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,qBAmDxC;AAED;;;;;oEAKoE;AACpE,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,qBA4C3F;AAED,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // Derivado do Calendar do Tremor (Apache-2.0) e modificado pela Strategicos.
4
+ // Ver THIRD_PARTY_NOTICES.md.
5
+ import * as React from "react";
6
+ import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
7
+ import { DayPicker } from "react-day-picker";
8
+ import { ptBR } from "react-day-picker/locale";
9
+ import { cn } from "../lib/utils.js";
10
+ import { buttonVariants } from "./button.js";
11
+ /**
12
+ * Calendário (react-day-picker), com o desenho do Calendar do Tremor nos tokens
13
+ * do kit. É a peça de dentro do DatePicker; use solto quando o calendário fica
14
+ * aberto na tela.
15
+ *
16
+ * <Calendar mode="single" selected={dia} onSelect={setDia} />
17
+ *
18
+ * Padrões: português do Brasil (semana começando no domingo) e dias de fora do
19
+ * mês visíveis. `captionLayout="dropdown"` troca o título por seletores de mês
20
+ * e ano — útil para datas distantes, como nascimento. Aceita todas as props do
21
+ * DayPicker.
22
+ */
23
+ function Calendar({ className, classNames, captionLayout = "label", showOutsideDays = true, locale = ptBR, components, ...props }) {
24
+ return (_jsx(DayPicker, { "data-slot": "calendar", locale: locale, showOutsideDays: showOutsideDays, captionLayout: captionLayout, className: cn("w-fit p-3", className), classNames: {
25
+ months: "relative flex flex-col gap-4 sm:flex-row",
26
+ month: "flex w-full flex-col gap-3",
27
+ nav: "absolute inset-x-0 top-0 flex items-center justify-between",
28
+ button_previous: cn(buttonVariants({ variant: "ghost", size: "icon-sm" }), "aria-disabled:pointer-events-none aria-disabled:opacity-40"),
29
+ button_next: cn(buttonVariants({ variant: "ghost", size: "icon-sm" }), "aria-disabled:pointer-events-none aria-disabled:opacity-40"),
30
+ month_caption: "flex h-7.5 items-center justify-center px-8",
31
+ // Os meses vêm em minúscula no pt-BR ("outubro 2026"): só a primeira
32
+ // letra sobe — `capitalize` faria "Outubro De 2026" em outros formatos.
33
+ caption_label: cn("text-sm font-semibold select-none first-letter:uppercase", captionLayout !== "label" && "flex h-7.5 items-center gap-1 rounded-md pr-1 pl-2 font-medium [&>svg]:size-3.5 [&>svg]:text-muted-foreground"),
34
+ dropdowns: "flex items-center gap-1.5 text-sm",
35
+ dropdown_root: "relative rounded-md border border-input transition-colors has-focus-visible:border-ring",
36
+ dropdown: "absolute inset-0 cursor-pointer opacity-0",
37
+ month_grid: "w-full border-collapse",
38
+ weekdays: "flex",
39
+ weekday: "w-9 pb-1 text-xs font-medium text-muted-foreground select-none",
40
+ week: "mt-0.5 flex w-full",
41
+ day: "relative size-9 p-0 text-center select-none",
42
+ // Faixa do intervalo: o fundo fica na célula, para os dias do meio
43
+ // emendarem; as pontas arredondam do lado de fora.
44
+ range_start: "rounded-l-md bg-accent",
45
+ range_middle: "bg-accent",
46
+ range_end: "rounded-r-md bg-accent",
47
+ today: "",
48
+ outside: "text-muted-foreground aria-selected:text-muted-foreground",
49
+ disabled: "text-muted-foreground opacity-50",
50
+ hidden: "invisible",
51
+ ...classNames,
52
+ }, components: {
53
+ Chevron: ({ className, orientation, ...rest }) => {
54
+ const Icon = orientation === "left" ? ChevronLeftIcon : orientation === "right" ? ChevronRightIcon : ChevronDownIcon;
55
+ return _jsx(Icon, { className: cn("size-4", className), ...rest });
56
+ },
57
+ DayButton: CalendarDayButton,
58
+ ...components,
59
+ }, ...props }));
60
+ }
61
+ /** Dia do calendário. Os estados viram data-* para o estilo, e "hoje" ganha o
62
+ * traço embaixo do número, como no Tremor.
63
+ *
64
+ * O dia escolhido é `data-picked`, e não `data-selected-*`: o styles.css
65
+ * registra a variante `data-selected`, e o Tailwind lê `data-selected-x:` como
66
+ * essa variante com um valor — a classe é descartada sem aviso. */
67
+ function CalendarDayButton({ className, day, modifiers, children, ...props }) {
68
+ const ref = React.useRef(null);
69
+ React.useEffect(() => {
70
+ if (modifiers.focused)
71
+ ref.current?.focus();
72
+ }, [modifiers.focused]);
73
+ const single = modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle;
74
+ return (_jsxs("button", { ref: ref, type: "button", "data-picked": single || undefined, "data-range-start": modifiers.range_start || undefined, "data-range-end": modifiers.range_end || undefined, "data-range-middle": modifiers.range_middle || undefined, "data-today": modifiers.today || undefined, className: cn("relative flex size-9 cursor-pointer items-center justify-center rounded-md text-sm tabular-nums outline-none transition-colors", "hover:bg-accent hover:text-accent-foreground focus-visible:z-10 focus-visible:ring-3 focus-visible:ring-ring/50", "disabled:pointer-events-none", "data-today:font-semibold",
75
+ // Dourado só como preenchimento, com o texto escuro do primary-foreground.
76
+ "data-picked:bg-primary data-picked:text-primary-foreground data-picked:hover:bg-primary-hover", "data-range-start:bg-primary data-range-start:text-primary-foreground data-range-start:hover:bg-primary-hover", "data-range-end:bg-primary data-range-end:text-primary-foreground data-range-end:hover:bg-primary-hover", "data-range-middle:rounded-none data-range-middle:hover:bg-transparent data-range-middle:hover:underline", className), ...props, children: [children, modifiers.today && (_jsx("span", { "aria-hidden": true, className: cn("absolute bottom-1.5 left-1/2 h-0.5 w-4 -translate-x-1/2 rounded-full",
77
+ // primary-strong: o dourado claro não chega a 3:1 sobre o branco.
78
+ single || modifiers.range_start || modifiers.range_end ? "bg-primary-foreground" : "bg-primary-strong") }))] }));
79
+ }
80
+ export { Calendar, CalendarDayButton };
81
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,6EAA6E;AAC7E,8BAA8B;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACjF,OAAO,EAAE,SAAS,EAAuB,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAE9C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C;;;;;;;;;;;GAWG;AACH,SAAS,QAAQ,CAAC,EAChB,SAAS,EACT,UAAU,EACV,aAAa,GAAG,OAAO,EACvB,eAAe,GAAG,IAAI,EACtB,MAAM,GAAG,IAAI,EACb,UAAU,EACV,GAAG,KAAK,EAC+B;IACvC,OAAO,CACL,KAAC,SAAS,iBACE,UAAU,EACpB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,EACrC,UAAU,EAAE;YACV,MAAM,EAAE,0CAA0C;YAClD,KAAK,EAAE,4BAA4B;YACnC,GAAG,EAAE,4DAA4D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,IACM,CACV,CAAA;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,73 @@
1
+ import * as React from "react";
2
+ export type ComboboxOption = {
3
+ value: string;
4
+ label: string;
5
+ /** Texto secundário (ex.: e-mail), só na lista. */
6
+ description?: string;
7
+ /** Agrupa as opções sob um título. */
8
+ group?: string;
9
+ /** Bolinha de cor antes do rótulo. */
10
+ color?: string;
11
+ disabled?: boolean;
12
+ };
13
+ /**
14
+ * Seleção de um item com busca, como o Select `searchable` do Mantine. Use no
15
+ * lugar do Select quando a lista é longa ou quando a tela precisa criar ou
16
+ * excluir opções ali mesmo.
17
+ *
18
+ * <Combobox
19
+ * options={setores.map(s => ({ value: s.id, label: s.name }))}
20
+ * value={setorId}
21
+ * onValueChange={setSetorId}
22
+ * clearable
23
+ * onCreate={async nome => (await criarSetor(nome)).id}
24
+ * />
25
+ *
26
+ * - `clearable`: um X no gatilho volta o valor para `null`.
27
+ * - `onCreate`: com texto na busca que não bate com nenhuma opção, aparece
28
+ * "Criar “texto”". Se a função devolver um valor, ele fica selecionado.
29
+ * - `onRemove`: cada opção ganha um X que pede confirmação na própria linha.
30
+ * Se a opção excluída era a selecionada, o valor volta para `null`.
31
+ *
32
+ * Erros de `onCreate`/`onRemove` (promessa rejeitada) aparecem no rodapé da
33
+ * lista, com a mensagem do erro.
34
+ *
35
+ * Teclado: digite para filtrar, ↑/↓ para andar, Enter para escolher, Delete
36
+ * (com a busca vazia) para excluir a opção ativa, Esc para fechar. Dentro de
37
+ * um <Field>, o gatilho recebe o id e os aria-*.
38
+ */
39
+ declare function Combobox({ options, value, onValueChange, placeholder, searchPlaceholder, emptyText, searchable, clearable, onCreate, createLabel, onRemove, removeLabel, removeConfirmLabel, size, disabled, className, wrapperClassName, contentClassName, onOpenChange, ...props }: {
40
+ options: ComboboxOption[];
41
+ value: string | null;
42
+ onValueChange: (value: string | null) => void;
43
+ placeholder?: string;
44
+ searchPlaceholder?: string;
45
+ emptyText?: string;
46
+ searchable?: boolean;
47
+ clearable?: boolean;
48
+ /** Cria uma opção com o texto da busca. Devolva o valor dela para
49
+ * selecioná-la. */
50
+ onCreate?: (label: string) => string | void | Promise<string | void>;
51
+ createLabel?: (query: string) => React.ReactNode;
52
+ /** Exclui a opção (o X na linha, depois de confirmar). */
53
+ onRemove?: (option: ComboboxOption) => void | Promise<void>;
54
+ /** Rótulo acessível do X de cada opção. */
55
+ removeLabel?: (option: ComboboxOption) => string;
56
+ /** Pergunta mostrada na linha ao confirmar a exclusão. */
57
+ removeConfirmLabel?: (option: ComboboxOption) => React.ReactNode;
58
+ size?: "sm" | "default";
59
+ disabled?: boolean;
60
+ /** Classes do gatilho. */
61
+ className?: string;
62
+ /** Classes do invólucro, que só existe com `clearable`. Use para largura e
63
+ * posição no layout. */
64
+ wrapperClassName?: string;
65
+ contentClassName?: string;
66
+ onOpenChange?: (open: boolean) => void;
67
+ id?: string;
68
+ "aria-label"?: string;
69
+ "aria-describedby"?: string;
70
+ "aria-invalid"?: React.AriaAttributes["aria-invalid"];
71
+ }): React.JSX.Element;
72
+ export { Combobox };
73
+ //# sourceMappingURL=combobox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,iBAAS,QAAQ,CAAC,EAChB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