@arkyn/components 3.0.7 → 3.0.8
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/AGENTS.md +906 -0
- package/package.json +2 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
# @arkyn/components — agent guide
|
|
2
|
+
|
|
3
|
+
React UI kit: 55 components, 11 hooks, 5 context providers, 2 services. Use it whenever you're asked to build forms, modals/drawers, tables, tabs, uploads, calendars, or similar UI in a React/Remix/React Router/Next project that has this package installed. Prefer these exports over hand-rolled markup or other UI libraries. Every prop, default, and behavior note below was read directly from source — this file is meant to be fully self-sufficient, you shouldn't need to open `node_modules` or README.md to use any of these correctly.
|
|
4
|
+
|
|
5
|
+
## Required setup
|
|
6
|
+
|
|
7
|
+
- ESM only: `import`, never `require()`.
|
|
8
|
+
- Always-required peer deps: `react`, `react-dom`, `lucide-react`.
|
|
9
|
+
- Optional peer deps, install only if the matching component/hook is used:
|
|
10
|
+
- `RichText` → `slate`, `slate-history`, `slate-react`, `is-hotkey`
|
|
11
|
+
- `MaskedInput`, `PhoneInput` → `@react-input/mask`
|
|
12
|
+
- `PlacesProvider`, `SearchPlaces` → `@react-google-maps/api`
|
|
13
|
+
- `MapView` → `mapbox-gl`
|
|
14
|
+
- `ToastProvider` / `useToast` → `react-hot-toast`
|
|
15
|
+
- `useAutomation`, `useSearchAutomation` → `react-scroll`
|
|
16
|
+
- `toRichTextValue` service → `html-react-parser`
|
|
17
|
+
|
|
18
|
+
## Import convention — always prefer subpath imports
|
|
19
|
+
|
|
20
|
+
Prefer importing each component/hook from its own subpath instead of the root barrel (`@arkyn/components`). It keeps editor/TS resolution scoped to what you actually use and lets you import only the CSS you need:
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { Button } from "@arkyn/components/button";
|
|
24
|
+
import "@arkyn/components/button.css";
|
|
25
|
+
|
|
26
|
+
import { IconButton } from "@arkyn/components/iconButton";
|
|
27
|
+
import "@arkyn/components/iconButton.css";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Naming rule**: the subpath is always the export name with only its first letter lowercased — nothing else changes. `Button` → `button`, `IconButton` → `iconButton`, `AlertContainer` → `alertContainer`, `useScopedParams` → `useScopedParams` (already lowercase-first, unchanged). This is exact and holds for every single export in this package — every subpath below follows it.
|
|
31
|
+
|
|
32
|
+
**CSS imports**: `import "@arkyn/components/<subpath>.css"` exists only for components that render their own visible markup. It does **not** exist (the import will fail) for: hooks, providers, services, and these specific components that render no styled markup of their own — `ClientOnly`, `FacebookPixel`, `GoogleAnalytics`, `GoogleTagManager`, `SearchPlaces` (inherits `Input`'s styling). Every other component listed below has a matching `.css` subpath — it's called out explicitly in each entry.
|
|
33
|
+
|
|
34
|
+
If you're using many components, importing the aggregate stylesheet once (`import "@arkyn/components/styles"`) instead of per-component CSS is simpler and avoids duplicate CSS between files that share internals (e.g. `FileUpload` and `Button`).
|
|
35
|
+
|
|
36
|
+
## Core patterns
|
|
37
|
+
|
|
38
|
+
Form field (label + input + error), wrap the tree in a `FormProvider` supplying field errors so error messages render automatically:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { FieldWrapper } from "@arkyn/components/fieldWrapper";
|
|
42
|
+
import { FieldLabel } from "@arkyn/components/fieldLabel";
|
|
43
|
+
import { Input } from "@arkyn/components/input";
|
|
44
|
+
import { FieldError } from "@arkyn/components/fieldError";
|
|
45
|
+
import { Button } from "@arkyn/components/button";
|
|
46
|
+
import "@arkyn/components/fieldWrapper.css";
|
|
47
|
+
import "@arkyn/components/fieldLabel.css";
|
|
48
|
+
import "@arkyn/components/input.css";
|
|
49
|
+
import "@arkyn/components/fieldError.css";
|
|
50
|
+
import "@arkyn/components/button.css";
|
|
51
|
+
|
|
52
|
+
<FieldWrapper>
|
|
53
|
+
<FieldLabel showAsterisk>Email</FieldLabel>
|
|
54
|
+
<Input name="email" type="email" placeholder="you@example.com" />
|
|
55
|
+
<FieldError>{errors.email}</FieldError>
|
|
56
|
+
</FieldWrapper>
|
|
57
|
+
<Button type="submit" scheme="primary">Save</Button>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Note: most form inputs (`Input`, `Textarea`, `Select`, etc.) already read `fieldErrors[name]` from `FormProvider` internally via `useForm()` and render their own error text — an explicit `FieldError` is only needed for fields without built-in error display, or to override.
|
|
61
|
+
|
|
62
|
+
Modal/drawer: wrap the app (or subtree) in the provider, open/close via the scoped hook by name:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { ModalProvider } from "@arkyn/components/modalProvider";
|
|
66
|
+
import { ModalContainer } from "@arkyn/components/modalContainer";
|
|
67
|
+
import { ModalHeader } from "@arkyn/components/modalHeader";
|
|
68
|
+
import { ModalFooter } from "@arkyn/components/modalFooter";
|
|
69
|
+
import { useModal } from "@arkyn/components/useModal";
|
|
70
|
+
import "@arkyn/components/modalContainer.css";
|
|
71
|
+
import "@arkyn/components/modalHeader.css";
|
|
72
|
+
import "@arkyn/components/modalFooter.css";
|
|
73
|
+
|
|
74
|
+
const { modalIsOpen, openModal, closeModal } = useModal("confirm-delete");
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Same pattern for `DrawerProvider`/`useDrawer` (`drawerIsOpen`/`openDrawer`/`closeDrawer`). Toasts: `ToastProvider` + `useToast().showToast({ message, type })`.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Forms & inputs
|
|
82
|
+
|
|
83
|
+
### Button
|
|
84
|
+
- Import: `import { Button } from "@arkyn/components/button";`
|
|
85
|
+
- Styles: `import "@arkyn/components/button.css";`
|
|
86
|
+
- Extends: native `<button>` attributes
|
|
87
|
+
- Props:
|
|
88
|
+
- `isLoading?: boolean` — shows a spinner and disables the button during async operations. Default: `false`.
|
|
89
|
+
- `loadingText?: string` — text displayed beside the spinner when `isLoading` is true.
|
|
90
|
+
- `size?: "xs" | "sm" | "md" | "lg"` — Default: `"md"`.
|
|
91
|
+
- `variant?: "solid" | "outline" | "ghost" | "invisible"` — `solid`: filled background. `outline`: bordered, transparent. `ghost`: no border, subtle hover. `invisible`: no visual styling. Default: `"solid"`.
|
|
92
|
+
- `scheme?: "primary" | "secondary" | "success" | "warning" | "danger" | "info"` — Default: `"primary"`.
|
|
93
|
+
- `leftIcon?: LucideIcon`
|
|
94
|
+
- `rightIcon?: LucideIcon`
|
|
95
|
+
|
|
96
|
+
### IconButton
|
|
97
|
+
- Import: `import { IconButton } from "@arkyn/components/iconButton";`
|
|
98
|
+
- Styles: `import "@arkyn/components/iconButton.css";`
|
|
99
|
+
- Extends: native `<button>` attributes, omitting `children` and `aria-label` (both redeclared)
|
|
100
|
+
- Notable: always requires `aria-label` for accessibility; disables itself and shows a spinner while `isLoading`.
|
|
101
|
+
- Props:
|
|
102
|
+
- `icon: LucideIcon` — required.
|
|
103
|
+
- `aria-label: string` — required (re-declared as required, unlike native optional `aria-label`).
|
|
104
|
+
- `isLoading?: boolean` — Default: `false`.
|
|
105
|
+
- `size?: "xs" | "sm" | "md" | "lg"` — Default: `"md"`.
|
|
106
|
+
- `variant?: "solid" | "outline" | "ghost" | "invisible"` — Default: `"solid"`.
|
|
107
|
+
- `scheme?: "primary" | "secondary" | "success" | "warning" | "danger" | "info"` — Default: `"primary"`.
|
|
108
|
+
|
|
109
|
+
### Input
|
|
110
|
+
- Import: `import { Input } from "@arkyn/components/input";`
|
|
111
|
+
- Styles: `import "@arkyn/components/input.css";`
|
|
112
|
+
- Extends: native `<input>` attributes, omitting `size`, `prefix`, `name`, `value`, `defaultValue` (redeclared below)
|
|
113
|
+
- Notable: renders wrapped in a field template (label/error/orientation); when `type="hidden"` it short-circuits to a plain hidden `<input>` ignoring most styling props.
|
|
114
|
+
- Requires context: reads `useForm()` internally for `fieldErrors[name]` — optional, but wrap in `FormProvider` to surface server-side validation errors automatically.
|
|
115
|
+
- Props:
|
|
116
|
+
- `name: string` — required.
|
|
117
|
+
- `label?: string`
|
|
118
|
+
- `errorMessage?: string` — validation error shown below the input.
|
|
119
|
+
- `isLoading?: boolean` — Default: `false`.
|
|
120
|
+
- `unShowFieldTemplate?: boolean` — skip the label/error wrapper. Default: `false`.
|
|
121
|
+
- `size?: "md" | "lg"` — Default: `"md"`.
|
|
122
|
+
- `variant?: "solid" | "outline" | "underline"` — Default: `"solid"`.
|
|
123
|
+
- `prefix?: string | LucideIcon` — rendered outside the input area, far left.
|
|
124
|
+
- `suffix?: string | LucideIcon` — rendered outside the input area, far right.
|
|
125
|
+
- `showAsterisk?: boolean`
|
|
126
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — Default: `"horizontal"`.
|
|
127
|
+
- `leftIcon?: LucideIcon` / `rightIcon?: LucideIcon` — rendered inside the input.
|
|
128
|
+
- `value?: string` / `defaultValue?: string`
|
|
129
|
+
|
|
130
|
+
### Textarea
|
|
131
|
+
- Import: `import { Textarea } from "@arkyn/components/textarea";`
|
|
132
|
+
- Styles: `import "@arkyn/components/textarea.css";`
|
|
133
|
+
- Extends: native `<textarea>` attributes, omitting `name`, `value`, `defaultValue` (redeclared)
|
|
134
|
+
- Notable: integrates with `useForm` for validation errors by field name; wraps the field in a clickable `<section>` that focuses the textarea when clicked anywhere in it.
|
|
135
|
+
- Props:
|
|
136
|
+
- `name: string` — required.
|
|
137
|
+
- `label?: string`
|
|
138
|
+
- `showAsterisk?: boolean`
|
|
139
|
+
- `errorMessage?: string`
|
|
140
|
+
- `size?: "md" | "lg"` — Default: `"md"`.
|
|
141
|
+
- `variant?: "solid" | "outline"` — Default: `"solid"`.
|
|
142
|
+
- `value?: string` / `defaultValue?: string`
|
|
143
|
+
|
|
144
|
+
### Checkbox
|
|
145
|
+
- Import: `import { Checkbox } from "@arkyn/components/checkbox";`
|
|
146
|
+
- Styles: `import "@arkyn/components/checkbox.css";`
|
|
147
|
+
- Extends: native `<button>` attributes minus `size`, `prefix`, `type`, `name`, `defaultValue`, `value`, `onChange`, `onSelect`, `onClick` (all redeclared)
|
|
148
|
+
- Notable: stores its value in a hidden `<input>` for native form submission.
|
|
149
|
+
- Requires context: reads `useForm()` for `fieldErrors[name]` — optional, works standalone without `FormProvider`.
|
|
150
|
+
- Props:
|
|
151
|
+
- `name: string` — required.
|
|
152
|
+
- `label?: string`
|
|
153
|
+
- `showAsterisk?: boolean`
|
|
154
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
155
|
+
- `errorMessage?: string`
|
|
156
|
+
- `size?: "sm" | "md" | "lg"` — Default: `"md"`.
|
|
157
|
+
- `value?: string` — value stored when checked. Default: `"checked"`.
|
|
158
|
+
- `checked?: boolean` / `defaultChecked?: boolean` (default `false`)
|
|
159
|
+
- `onCheck?: (value: string) => void` — receives the value string (or `""` when unchecked).
|
|
160
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — Default: `"horizontalReverse"`.
|
|
161
|
+
|
|
162
|
+
### Switch
|
|
163
|
+
- Import: `import { Switch } from "@arkyn/components/switch";`
|
|
164
|
+
- Styles: `import "@arkyn/components/switch.css";`
|
|
165
|
+
- Extends: native `<button>` attributes minus `children`, `onChange`, `defaultValue`, `onCheck`, `value` (redeclared)
|
|
166
|
+
- Notable: renders as a `<button>` storing its value in a hidden `<input>`; integrates with `useForm`.
|
|
167
|
+
- Props:
|
|
168
|
+
- `name: string` — required.
|
|
169
|
+
- `label?: string`
|
|
170
|
+
- `size?: "sm" | "md" | "lg"` — Default: `"lg"`.
|
|
171
|
+
- `checked?: boolean` / `defaultChecked?: boolean` (default `false`)
|
|
172
|
+
- `value?: string` — value emitted when on. Default: `"checked"`.
|
|
173
|
+
- `unCheckedValue?: string` — value emitted when off. Default: `""`.
|
|
174
|
+
- `onCheck?: (value: string) => void`
|
|
175
|
+
- `orientation?: "vertical" | "horizontal" | "horizontalReverse"` — Default: `"horizontalReverse"`.
|
|
176
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
177
|
+
- `showAsterisk?: boolean`
|
|
178
|
+
- `errorMessage?: string`
|
|
179
|
+
|
|
180
|
+
### Select
|
|
181
|
+
- Import: `import { Select } from "@arkyn/components/select";`
|
|
182
|
+
- Styles: `import "@arkyn/components/select.css";`
|
|
183
|
+
- Extends: no native element, own props only
|
|
184
|
+
- Notable: single-option dropdown with optional search; integrates with `useForm` by field name.
|
|
185
|
+
- Props:
|
|
186
|
+
- `name: string` — required.
|
|
187
|
+
- `options: { label: string; value: string }[]` — required.
|
|
188
|
+
- `id?: string`
|
|
189
|
+
- `value?: string` / `defaultValue?: string` (default `""`)
|
|
190
|
+
- `showAsterisk?: boolean`
|
|
191
|
+
- `label?: string`
|
|
192
|
+
- `errorMessage?: string`
|
|
193
|
+
- `placeholder?: string` — Default: `"Selecione..."`.
|
|
194
|
+
- `notFoundText?: string` — Default: `"Sem opções disponíveis"`.
|
|
195
|
+
- `className?: string`
|
|
196
|
+
- `disabled?: boolean` / `readOnly?: boolean` / `isLoading?: boolean` — all default `false`.
|
|
197
|
+
- `isSearchable?: boolean` — Default: `false`.
|
|
198
|
+
- `closeOnSelect?: boolean` — Default: `true`.
|
|
199
|
+
- `onSearch?: (value: string) => void` — for async option loading.
|
|
200
|
+
- `onChange?: (value: string) => void`
|
|
201
|
+
- `onFocus?: () => void` / `onBlur?: (e: FocusEvent<HTMLDivElement>) => void`
|
|
202
|
+
- `size?: "md" | "lg"` — Default: `"md"`.
|
|
203
|
+
- `variant?: "solid" | "outline" | "underline"` — Default: `"solid"`.
|
|
204
|
+
- `prefix?: string | LucideIcon` / `leftIcon?: LucideIcon`
|
|
205
|
+
- `optionMaxHeight?: number`
|
|
206
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
207
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — runtime default is `"vertical"` (JSDoc says `"horizontal"`, code differs — verify visually if it matters).
|
|
208
|
+
|
|
209
|
+
### MultiSelect
|
|
210
|
+
- Import: `import { MultiSelect } from "@arkyn/components/multiSelect";`
|
|
211
|
+
- Styles: `import "@arkyn/components/multiSelect.css";`
|
|
212
|
+
- Extends: no native element, own props only
|
|
213
|
+
- Notable: same as `Select` but `value`/`defaultValue`/`onChange` work on `string[]`; selected values stored as a JSON array in a hidden `<input>`.
|
|
214
|
+
- Props: same as `Select` above, except:
|
|
215
|
+
- `value?: string[]` / `defaultValue?: string[]` (default `[]`)
|
|
216
|
+
- `onChange?: (value: string[]) => void`
|
|
217
|
+
- `closeOnSelect?: boolean` — Default: `false` (differs from `Select`'s `true`).
|
|
218
|
+
- (no `readOnly` documented — check before relying on it)
|
|
219
|
+
|
|
220
|
+
### RadioGroup
|
|
221
|
+
- Import: `import { RadioGroup } from "@arkyn/components/radioGroup";`
|
|
222
|
+
- Styles: `import "@arkyn/components/radioGroup.css";`
|
|
223
|
+
- Extends: native `<div>` attributes minus `onChange`
|
|
224
|
+
- Notable: renders a hidden `<input>` for native form submission; reads `fieldErrors[name]` from `FormProvider` when no `errorMessage` is explicitly provided. Provides `RadioProvider` context consumed by child `RadioBox`.
|
|
225
|
+
- Props:
|
|
226
|
+
- `name: string` — required.
|
|
227
|
+
- `label?: string`
|
|
228
|
+
- `showAsterisk?: boolean` — Default: `false`.
|
|
229
|
+
- `errorMessage?: string` — overrides the `FormProvider` error.
|
|
230
|
+
- `value?: string` / `defaultValue?: string` (default `""`)
|
|
231
|
+
- `onChange?: (value: string) => void`
|
|
232
|
+
- `size?: "sm" | "md" | "lg"` — applied to all `RadioBox` children. Default: `"md"`.
|
|
233
|
+
- `disabled?: boolean` — disables all children. Default: `false`.
|
|
234
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
235
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — runtime default `"vertical"`.
|
|
236
|
+
|
|
237
|
+
### RadioBox
|
|
238
|
+
- Import: `import { RadioBox } from "@arkyn/components/radioBox";`
|
|
239
|
+
- Styles: `import "@arkyn/components/radioBox.css";`
|
|
240
|
+
- Extends: native `<button>` attributes
|
|
241
|
+
- Notable: renders as a `<label>` wrapping a hidden `<button>`.
|
|
242
|
+
- Requires context: must be a direct child of `RadioGroup` — reads active value/size/error/disabled via its context.
|
|
243
|
+
- Props:
|
|
244
|
+
- `value: string` — required.
|
|
245
|
+
- `isError?: boolean` — inherited from `RadioGroup` when unset.
|
|
246
|
+
- `size?: "sm" | "md" | "lg"` — inherited from `RadioGroup` when unset.
|
|
247
|
+
|
|
248
|
+
### CurrencyInput
|
|
249
|
+
- Import: `import { CurrencyInput } from "@arkyn/components/currencyInput";`
|
|
250
|
+
- Styles: `import "@arkyn/components/currencyInput.css";`
|
|
251
|
+
- Extends: native `<input>` attributes minus `size`, `prefix`, `name`, `type`, `max`, `defaultValue`, `value`, `onChange`, `placeholder` (redeclared)
|
|
252
|
+
- Notable: raw numeric value stored in a separate hidden `<input>` for form submission; visible input shows the locale-formatted string.
|
|
253
|
+
- Props:
|
|
254
|
+
- `name: string` — required.
|
|
255
|
+
- `locale: "USD" | "EUR" | "JPY" | "GBP" | "AUD" | "CAD" | "CHF" | "CNY" | "SEK" | "NZD" | "BRL" | "INR" | "RUB" | "ZAR" | "MXN" | "SGD" | "HKD" | "NOK" | "KRW" | "TRY" | "IDR" | "THB"` — required.
|
|
256
|
+
- `label?: string` / `errorMessage?: string`
|
|
257
|
+
- `isLoading?: boolean` — Default: `false`.
|
|
258
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
259
|
+
- `size?: "md" | "lg"` — Default: `"md"`.
|
|
260
|
+
- `variant?: "solid" | "outline" | "underline"` — Default: `"solid"`.
|
|
261
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — Default: `"horizontal"`.
|
|
262
|
+
- `prefix?: string | LucideIcon` / `suffix?: string | LucideIcon`
|
|
263
|
+
- `showAsterisk?: boolean`
|
|
264
|
+
- `leftIcon?: LucideIcon` / `rightIcon?: LucideIcon`
|
|
265
|
+
- `max?: number` — Default: `1_000_000_000`.
|
|
266
|
+
- `value?: number` / `defaultValue?: number`
|
|
267
|
+
- `onChange?: (event: ChangeEvent<HTMLInputElement>, originalValue: string, maskedValue: string) => void` — `originalValue` e.g. `"1234.56"`, `maskedValue` e.g. `"$ 1,234.56"`.
|
|
268
|
+
|
|
269
|
+
### MaskedInput
|
|
270
|
+
- Import: `import { MaskedInput } from "@arkyn/components/maskedInput";`
|
|
271
|
+
- Styles: `import "@arkyn/components/maskedInput.css";`
|
|
272
|
+
- Extends: native `<input>` attributes, omitting `size`, `prefix`, `name`, `type`
|
|
273
|
+
- Requires peer dependency: `@react-input/mask`.
|
|
274
|
+
- Notable: integrates with `useForm` for validation errors.
|
|
275
|
+
- Props:
|
|
276
|
+
- `name: string` — required.
|
|
277
|
+
- `mask: string` — e.g. `"(__) _____-____"`. Required.
|
|
278
|
+
- `replacement: string | Replacement` — editable placeholder character/map. Required.
|
|
279
|
+
- `separate?: boolean` — strip mask characters from the underlying value.
|
|
280
|
+
- `showMask?: boolean` — show full mask pattern before typing.
|
|
281
|
+
- `label?: string` / `errorMessage?: string`
|
|
282
|
+
- `isLoading?: boolean` — Default: `false`.
|
|
283
|
+
- `size?: "md" | "lg"` — Default: `"md"`.
|
|
284
|
+
- `variant?: "solid" | "outline" | "underline"` — Default: `"solid"`.
|
|
285
|
+
- `prefix?: string | LucideIcon` / `suffix?: string | LucideIcon`
|
|
286
|
+
- `showAsterisk?: boolean`
|
|
287
|
+
- `leftIcon?: LucideIcon` / `rightIcon?: LucideIcon`
|
|
288
|
+
- `value?: string` / `defaultValue?: string`
|
|
289
|
+
|
|
290
|
+
### PhoneInput
|
|
291
|
+
- Import: `import { PhoneInput } from "@arkyn/components/phoneInput";`
|
|
292
|
+
- Styles: `import "@arkyn/components/phoneInput.css";`
|
|
293
|
+
- Extends: no native element, own props only
|
|
294
|
+
- Requires peer dependency: `@react-input/mask`. Also uses `@arkyn/shared` (`findCountryMask`, `formatToPhone`, `removeNonNumeric`) and `@arkyn/templates` (`countries`) internally.
|
|
295
|
+
- Notable: integrated country selector with automatic mask per country; hidden `<input>` stores a numeric string prefixed with the country dial code.
|
|
296
|
+
- Props:
|
|
297
|
+
- `name: string` — required (stored value includes country code).
|
|
298
|
+
- `id?: string`
|
|
299
|
+
- `disabled?: boolean` / `readOnly?: boolean` — default `false`.
|
|
300
|
+
- `errorMessage?: string` — overrides the `useForm` context error.
|
|
301
|
+
- `label?: string` / `showAsterisk?: boolean`
|
|
302
|
+
- `isLoading?: boolean` — Default: `false`.
|
|
303
|
+
- `size?: "md" | "lg"` — Default: `"md"`.
|
|
304
|
+
- `variant?: "solid" | "outline"` — Default: `"solid"`.
|
|
305
|
+
- `className?: string`
|
|
306
|
+
- `defaultValue?: string` — numeric string, with or without country code. Default: `""`.
|
|
307
|
+
- `notFoundCountryText?: string` — Default: `"Nenhum país encontrado"`.
|
|
308
|
+
- `searchCountryPlaceholder?: string` — Default: `"Pesquisar país"`.
|
|
309
|
+
- `defaultCountryIso?: (typeof countries)[number]["iso"]` — Default: `"BR"`.
|
|
310
|
+
- `onChange?: (e: string) => void` — receives numeric string with country dial code.
|
|
311
|
+
- `value?: string` — controlled, without country code.
|
|
312
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
313
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — Default: `"vertical"`.
|
|
314
|
+
|
|
315
|
+
### Slider
|
|
316
|
+
- Import: `import { Slider } from "@arkyn/components/slider";`
|
|
317
|
+
- Styles: `import "@arkyn/components/slider.css";`
|
|
318
|
+
- Extends: native `<div>` attributes minus `onChange`
|
|
319
|
+
- Notable: supports click-to-set and drag-to-set positioning; pairs naturally with the `useSlider` hook for managed state.
|
|
320
|
+
- Props:
|
|
321
|
+
- `value: number` — 0–100. Required.
|
|
322
|
+
- `onChange: (value: number) => void` — required.
|
|
323
|
+
- `disabled?: boolean` — Default: `false`.
|
|
324
|
+
- `onDragging?: (isDragging: boolean) => void` — fires on drag start/end.
|
|
325
|
+
|
|
326
|
+
### FieldWrapper
|
|
327
|
+
- Import: `import { FieldWrapper } from "@arkyn/components/fieldWrapper";`
|
|
328
|
+
- Styles: `import "@arkyn/components/fieldWrapper.css";`
|
|
329
|
+
- Extends: native `<section>` attributes
|
|
330
|
+
- Notable: pure layout container grouping a field with its label/error.
|
|
331
|
+
- Props:
|
|
332
|
+
- `children: ReactNode` — required.
|
|
333
|
+
- `orientation?: "vertical" | "horizontal" | "horizontalReverse"` — Default: `"vertical"`.
|
|
334
|
+
|
|
335
|
+
### FieldLabel
|
|
336
|
+
- Import: `import { FieldLabel } from "@arkyn/components/fieldLabel";`
|
|
337
|
+
- Styles: `import "@arkyn/components/fieldLabel.css";`
|
|
338
|
+
- Extends: native `<label>` attributes
|
|
339
|
+
- Props:
|
|
340
|
+
- `showAsterisk?: boolean` — appends `*`. Default: `false`.
|
|
341
|
+
|
|
342
|
+
### FieldError
|
|
343
|
+
- Import: `import { FieldError } from "@arkyn/components/fieldError";`
|
|
344
|
+
- Styles: `import "@arkyn/components/fieldError.css";`
|
|
345
|
+
- Extends: native `<strong>` attributes
|
|
346
|
+
- Notable: renders nothing (`null`) when `children` is empty/falsy.
|
|
347
|
+
- Props: none beyond `<strong>` attributes.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Uploads
|
|
352
|
+
|
|
353
|
+
All three uploaders share the same shape: drag-and-drop UI, `fetch` a `multipart/form-data` request to `action`, store the returned URL in a hidden `<input name={name}>` for native form submission, read `useForm()`'s `fieldErrors[name]` optionally (works standalone without `FormProvider`).
|
|
354
|
+
|
|
355
|
+
### FileUpload
|
|
356
|
+
- Import: `import { FileUpload } from "@arkyn/components/fileUpload";`
|
|
357
|
+
- Styles: `import "@arkyn/components/fileUpload.css";`
|
|
358
|
+
- Props:
|
|
359
|
+
- `name: string` / `action: string` — both required.
|
|
360
|
+
- `disabled?: boolean` — Default: `false`.
|
|
361
|
+
- `label?: string` / `showAsterisk?: boolean` (default `false`)
|
|
362
|
+
- `changeFileButtonText?: string` — Default: `"Alterar arquivo"`.
|
|
363
|
+
- `selectFileButtonText?: string` — Default: `"Selecionar arquivo"`.
|
|
364
|
+
- `dropFileText?: string` — Default: `"Ou arraste e solte o arquivo aqui"`.
|
|
365
|
+
- `method?: string` — Default: `"POST"`.
|
|
366
|
+
- `fileName?: string` — form-data field name. Default: `"file"`.
|
|
367
|
+
- `fileResponseName?: string` — response property holding the URL. Default: `"url"`.
|
|
368
|
+
- `acceptFile?: string` — Default: `"*"`.
|
|
369
|
+
- `onChange?: (url?: string) => void` — fires after successful upload.
|
|
370
|
+
|
|
371
|
+
### ImageUpload
|
|
372
|
+
- Import: `import { ImageUpload } from "@arkyn/components/imageUpload";`
|
|
373
|
+
- Styles: `import "@arkyn/components/imageUpload.css";`
|
|
374
|
+
- Props:
|
|
375
|
+
- `name: string` / `action: string` — both required.
|
|
376
|
+
- `defaultValue?: string | null` — pre-populated preview URL. Default: `""`.
|
|
377
|
+
- `className?: string`
|
|
378
|
+
- `disabled?: boolean` — Default: `false`.
|
|
379
|
+
- `label?: string` / `showAsterisk?: boolean` (default `false`)
|
|
380
|
+
- `changeImageButtonText?: string` — Default: `"Alterar imagem"`.
|
|
381
|
+
- `selectImageButtonText?: string` — Default: `"Selecionar imagem"`.
|
|
382
|
+
- `dropImageText?: string` — Default: `"Ou arraste e solte a imagem aqui"`.
|
|
383
|
+
- `method?: string` — Default: `"POST"`.
|
|
384
|
+
- `fileName?: string` — Default: `"file"`.
|
|
385
|
+
- `fileResponseName?: string` — Default: `"url"`.
|
|
386
|
+
- `acceptImage?: string` — Default: `"image/*"`.
|
|
387
|
+
- `onChange?: (url: string) => void`
|
|
388
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
389
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — runtime default `"vertical"`.
|
|
390
|
+
|
|
391
|
+
### AudioUpload
|
|
392
|
+
- Import: `import { AudioUpload } from "@arkyn/components/audioUpload";`
|
|
393
|
+
- Styles: `import "@arkyn/components/audioUpload.css";`
|
|
394
|
+
- Props:
|
|
395
|
+
- `name: string` / `action: string` — both required.
|
|
396
|
+
- `fileName?: string` — Default: `"file"`.
|
|
397
|
+
- `method?: string` — Default: `"POST"`.
|
|
398
|
+
- `acceptAudio?: string` — Default: `"audio/*"`.
|
|
399
|
+
- `dropAudioText?: string` — Default: `"Ou arraste e solte um arquivo de áudio aqui"`.
|
|
400
|
+
- `selectAudioButtonText?: string` — Default: `"Selecionar arquivo de áudio"`.
|
|
401
|
+
- `changeAudioButtonText?: string` — Default: `"Trocar arquivo de áudio"`.
|
|
402
|
+
- `onChange?: (url?: string) => void`
|
|
403
|
+
- `fileResponseName?: string` — Default: `"url"`.
|
|
404
|
+
- `label?: string` / `showAsterisk?: boolean` (default `false`)
|
|
405
|
+
- `disabled?: boolean` — Default: `false`.
|
|
406
|
+
- `defaultValue?: string` — Default: `""`.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Layout & navigation
|
|
411
|
+
|
|
412
|
+
### TabContainer
|
|
413
|
+
- Import: `import { TabContainer } from "@arkyn/components/tabContainer";`
|
|
414
|
+
- Styles: `import "@arkyn/components/tabContainer.css";`
|
|
415
|
+
- Extends: native `<nav>`/HTMLElement attributes minus `onChange`, `children`, `ref`, `onClick`
|
|
416
|
+
- Notable: manages active-tab state for `TabButton` children; renders as `<nav>`.
|
|
417
|
+
- Props:
|
|
418
|
+
- `children: ReactNode` — `TabButton`s. Required.
|
|
419
|
+
- `disabled?: boolean` — disables all tabs. Default: `false`.
|
|
420
|
+
- `defaultValue?: string`
|
|
421
|
+
- `onChange?: (index: string) => void`
|
|
422
|
+
|
|
423
|
+
### TabButton
|
|
424
|
+
- Import: `import { TabButton } from "@arkyn/components/tabButton";`
|
|
425
|
+
- Styles: `import "@arkyn/components/tabButton.css";`
|
|
426
|
+
- Extends: native `<button>` attributes minus `children`, `value`, `type` (always renders `type="button"`)
|
|
427
|
+
- Requires context: must be inside a `TabContainer`.
|
|
428
|
+
- Notable: own `disabled` is OR'd with the container's `disabled`.
|
|
429
|
+
- Props:
|
|
430
|
+
- `children: ReactNode` — required.
|
|
431
|
+
- `value: string` — matched against the container's active value. Required.
|
|
432
|
+
- `disabled?: boolean` — disables this tab individually.
|
|
433
|
+
|
|
434
|
+
### CardTabContainer
|
|
435
|
+
- Import: `import { CardTabContainer } from "@arkyn/components/cardTabContainer";`
|
|
436
|
+
- Styles: `import "@arkyn/components/cardTabContainer.css";`
|
|
437
|
+
- Extends: native HTMLElement attributes (renders `<nav>`) minus `onClick`, `children`, `ref`, `onChange`
|
|
438
|
+
- Notable: same active-tab management pattern as `TabContainer`, styled as cards.
|
|
439
|
+
- Props: same shape as `TabContainer` — `children: ReactNode` (required), `disabled?: boolean` (default `false`), `defaultValue?: string`, `onChange?: (index: string) => void`.
|
|
440
|
+
|
|
441
|
+
### CardTabButton
|
|
442
|
+
- Import: `import { CardTabButton } from "@arkyn/components/cardTabButton";`
|
|
443
|
+
- Styles: `import "@arkyn/components/cardTabButton.css";`
|
|
444
|
+
- Extends: native `<button>` attributes minus `children`, `value`, `type`
|
|
445
|
+
- Requires context: must be inside a `CardTabContainer`.
|
|
446
|
+
- Props:
|
|
447
|
+
- `children: ReactNode` — required.
|
|
448
|
+
- `value: string` — required.
|
|
449
|
+
|
|
450
|
+
### Pagination
|
|
451
|
+
- Import: `import { Pagination } from "@arkyn/components/pagination";`
|
|
452
|
+
- Styles: `import "@arkyn/components/pagination.css";`
|
|
453
|
+
- Extends: native `<div>` attributes minus `onChange`
|
|
454
|
+
- Notable: renders page number buttons, prev/next chevrons, and `…` spread indicators.
|
|
455
|
+
- Props:
|
|
456
|
+
- `totalCountRegisters: number` — required.
|
|
457
|
+
- `currentPage: number` — 1-indexed. Required.
|
|
458
|
+
- `siblingsCount?: number` — Default: `1`.
|
|
459
|
+
- `registerPerPage?: number` — Default: `10`.
|
|
460
|
+
- `onChange?: (page: number) => void`
|
|
461
|
+
|
|
462
|
+
### Divider
|
|
463
|
+
- Import: `import { Divider } from "@arkyn/components/divider";`
|
|
464
|
+
- Styles: `import "@arkyn/components/divider.css";`
|
|
465
|
+
- Extends: native `<div>` attributes
|
|
466
|
+
- Props:
|
|
467
|
+
- `orientation?: "horizontal" | "vertical"` — Default: `"horizontal"`.
|
|
468
|
+
|
|
469
|
+
### Badge
|
|
470
|
+
- Import: `import { Badge } from "@arkyn/components/badge";`
|
|
471
|
+
- Styles: `import "@arkyn/components/badge.css";`
|
|
472
|
+
- Extends: native `<div>` attributes
|
|
473
|
+
- Props:
|
|
474
|
+
- `size?: "md" | "lg"` — Default: `"lg"`.
|
|
475
|
+
- `variant?: "solid" | "outline" | "ghost"` — Default: `"ghost"`.
|
|
476
|
+
- `scheme?: "primary" | "secondary" | "success" | "warning" | "danger" | "info"` — Default: `"primary"`.
|
|
477
|
+
- `leftIcon?: LucideIcon` / `rightIcon?: LucideIcon`
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## Overlays
|
|
482
|
+
|
|
483
|
+
### ModalContainer
|
|
484
|
+
- Import: `import { ModalContainer } from "@arkyn/components/modalContainer";`
|
|
485
|
+
- Styles: `import "@arkyn/components/modalContainer.css";`
|
|
486
|
+
- Extends: native HTMLElement attributes
|
|
487
|
+
- Notable: animated centered modal over a backdrop, locks body scroll while open, closes on overlay click. Provides context consumed by `ModalHeader`.
|
|
488
|
+
- Props:
|
|
489
|
+
- `isVisible: boolean` — required.
|
|
490
|
+
- `makeInvisible: () => void` — called when the overlay is clicked. Required.
|
|
491
|
+
|
|
492
|
+
### ModalHeader
|
|
493
|
+
- Import: `import { ModalHeader } from "@arkyn/components/modalHeader";`
|
|
494
|
+
- Styles: `import "@arkyn/components/modalHeader.css";`
|
|
495
|
+
- Extends: native `<header>` attributes
|
|
496
|
+
- Requires context: must be rendered inside `ModalContainer`.
|
|
497
|
+
- Props:
|
|
498
|
+
- `showCloseButton?: boolean` — Default: `true`.
|
|
499
|
+
|
|
500
|
+
### ModalFooter
|
|
501
|
+
- Import: `import { ModalFooter } from "@arkyn/components/modalFooter";`
|
|
502
|
+
- Styles: `import "@arkyn/components/modalFooter.css";`
|
|
503
|
+
- Extends: native `<footer>` attributes
|
|
504
|
+
- Props:
|
|
505
|
+
- `alignment?: "left" | "center" | "right" | "between" | "around"` — Default: `"right"`.
|
|
506
|
+
|
|
507
|
+
### DrawerContainer
|
|
508
|
+
- Import: `import { DrawerContainer } from "@arkyn/components/drawerContainer";`
|
|
509
|
+
- Styles: `import "@arkyn/components/drawerContainer.css";`
|
|
510
|
+
- Extends: native `<aside>` attributes
|
|
511
|
+
- Notable: animated slide-in panel, locks body scroll while open, closes on overlay click. Provides context consumed by `DrawerHeader`.
|
|
512
|
+
- Props:
|
|
513
|
+
- `isVisible: boolean` — required.
|
|
514
|
+
- `makeInvisible: () => void` — required.
|
|
515
|
+
- `orientation?: "left" | "right"` — side it slides in from. Default: `"left"`.
|
|
516
|
+
|
|
517
|
+
### DrawerHeader
|
|
518
|
+
- Import: `import { DrawerHeader } from "@arkyn/components/drawerHeader";`
|
|
519
|
+
- Styles: `import "@arkyn/components/drawerHeader.css";`
|
|
520
|
+
- Extends: native `<header>` attributes
|
|
521
|
+
- Requires context: must be rendered inside `DrawerContainer`.
|
|
522
|
+
- Props:
|
|
523
|
+
- `showCloseButton?: boolean` — Default: `true`.
|
|
524
|
+
|
|
525
|
+
### Popover
|
|
526
|
+
- Import: `import { Popover } from "@arkyn/components/popover";`
|
|
527
|
+
- Styles: `import "@arkyn/components/popover.css";`
|
|
528
|
+
- Extends: no native element, own props only
|
|
529
|
+
- Notable: dismisses on outside click; locks body scroll while open.
|
|
530
|
+
- Props:
|
|
531
|
+
- `children: ReactNode` — floating panel content. Required.
|
|
532
|
+
- `button: ReactNode` — trigger element. Required.
|
|
533
|
+
- `closeOnClick?: boolean` — clicking content also closes it. Default: `false`.
|
|
534
|
+
- `orientation?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight" | "top" | "left" | "bottom" | "right"` — Default: `"bottomLeft"`.
|
|
535
|
+
- `className?: string`
|
|
536
|
+
|
|
537
|
+
### Tooltip
|
|
538
|
+
- Import: `import { Tooltip } from "@arkyn/components/tooltip";`
|
|
539
|
+
- Styles: `import "@arkyn/components/tooltip.css";`
|
|
540
|
+
- Extends: native `<div>` attributes minus `children`
|
|
541
|
+
- Notable: viewport-aware — flips to the opposite side automatically if it would overflow (checked again after first flip).
|
|
542
|
+
- Props:
|
|
543
|
+
- `text: string` — supports inline HTML (rendered via `dangerouslySetInnerHTML`). Required.
|
|
544
|
+
- `children: ReactNode` — trigger element. Required.
|
|
545
|
+
- `orientation?: "top" | "right" | "bottom" | "left"` — preferred side. Default: `"top"`.
|
|
546
|
+
- `size?: "md" | "lg"` — Default: `"lg"`.
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## Feedback
|
|
551
|
+
|
|
552
|
+
### AlertContainer
|
|
553
|
+
- Import: `import { AlertContainer } from "@arkyn/components/alertContainer";`
|
|
554
|
+
- Styles: `import "@arkyn/components/alertContainer.css";`
|
|
555
|
+
- Extends: native `<div>` attributes
|
|
556
|
+
- Notable: auto-detects a nested `AlertTitle` to switch centered vs left-aligned layout; provides `scheme` context to children (e.g. `AlertIcon`).
|
|
557
|
+
- Props:
|
|
558
|
+
- `scheme: "success" | "danger" | "warning" | "info"` — required, no default.
|
|
559
|
+
|
|
560
|
+
### AlertTitle
|
|
561
|
+
- Import: `import { AlertTitle } from "@arkyn/components/alertTitle";`
|
|
562
|
+
- Styles: `import "@arkyn/components/alertTitle.css";`
|
|
563
|
+
- Extends: native `<div>` attributes
|
|
564
|
+
- Notable: its presence among `AlertContainer`'s children switches the container to left-aligned layout.
|
|
565
|
+
- Props: none beyond `<div>` attributes.
|
|
566
|
+
|
|
567
|
+
### AlertDescription
|
|
568
|
+
- Import: `import { AlertDescription } from "@arkyn/components/alertDescription";`
|
|
569
|
+
- Styles: `import "@arkyn/components/alertDescription.css";`
|
|
570
|
+
- Extends: native `<div>` attributes
|
|
571
|
+
- Props: none beyond `<div>` attributes.
|
|
572
|
+
|
|
573
|
+
### AlertContent
|
|
574
|
+
- Import: `import { AlertContent } from "@arkyn/components/alertContent";`
|
|
575
|
+
- Styles: `import "@arkyn/components/alertContent.css";`
|
|
576
|
+
- Extends: native `<div>` attributes
|
|
577
|
+
- Notable: wraps `AlertTitle`/`AlertDescription`.
|
|
578
|
+
- Props: none beyond `<div>` attributes.
|
|
579
|
+
|
|
580
|
+
### AlertIcon
|
|
581
|
+
- Import: `import { AlertIcon } from "@arkyn/components/alertIcon";`
|
|
582
|
+
- Styles: `import "@arkyn/components/alertIcon.css";`
|
|
583
|
+
- Extends: `LucideProps` (no native HTML element)
|
|
584
|
+
- Requires context: must be inside `AlertContainer` — reads `scheme` to pick the icon (`success`→`CheckCircle2`, `danger`→`XCircle`, `warning`→`AlertTriangle`, `info`→`Info`).
|
|
585
|
+
- Props: none beyond `LucideProps` (`size`, `color`, `strokeWidth`, `className`, etc.).
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
## Data display (Table)
|
|
590
|
+
|
|
591
|
+
All four sub-parts render inside `TableContainer`.
|
|
592
|
+
|
|
593
|
+
### TableContainer
|
|
594
|
+
- Import: `import { TableContainer } from "@arkyn/components/tableContainer";`
|
|
595
|
+
- Styles: `import "@arkyn/components/tableContainer.css";`
|
|
596
|
+
- Extends: native `<table>` attributes
|
|
597
|
+
- Notable: root wrapper; renders a responsive scrollable `<div>` around an inner `<table>` (props apply to the outer `<div>`, not the `<table>` itself).
|
|
598
|
+
- Props: none beyond `<table>` attributes.
|
|
599
|
+
|
|
600
|
+
### TableHeader
|
|
601
|
+
- Import: `import { TableHeader } from "@arkyn/components/tableHeader";`
|
|
602
|
+
- Styles: `import "@arkyn/components/tableHeader.css";`
|
|
603
|
+
- Extends: native `<thead>` attributes
|
|
604
|
+
- Notable: wraps children (expected `<th>` elements) in an automatic `<tr>`, followed by an automatic spacing `<tr className="spacingRow" />`.
|
|
605
|
+
- Props: none beyond `<thead>` attributes.
|
|
606
|
+
|
|
607
|
+
### TableBody
|
|
608
|
+
- Import: `import { TableBody } from "@arkyn/components/tableBody";`
|
|
609
|
+
- Styles: `import "@arkyn/components/tableBody.css";`
|
|
610
|
+
- Extends: native `<tbody>` attributes
|
|
611
|
+
- Notable: when `children` is empty, renders a full-width (`colSpan={100}`) empty-state row instead.
|
|
612
|
+
- Props:
|
|
613
|
+
- `emptyMessage?: string` — Default: `"Nenhum dado adicionado."`.
|
|
614
|
+
|
|
615
|
+
### TableFooter
|
|
616
|
+
- Import: `import { TableFooter } from "@arkyn/components/tableFooter";`
|
|
617
|
+
- Styles: `import "@arkyn/components/tableFooter.css";`
|
|
618
|
+
- Extends: native `<tfoot>` attributes
|
|
619
|
+
- Notable: auto-inserts a spacing `<tr>` above the content row; children wrapped in `<th colSpan={100}>` (commonly used for `Pagination`).
|
|
620
|
+
- Props: none beyond `<tfoot>` attributes.
|
|
621
|
+
|
|
622
|
+
### TableCaption
|
|
623
|
+
- Import: `import { TableCaption } from "@arkyn/components/tableCaption";`
|
|
624
|
+
- Styles: `import "@arkyn/components/tableCaption.css";`
|
|
625
|
+
- Extends: native HTMLElement attributes (renders `<caption>`)
|
|
626
|
+
- Notable: wraps children in an inner `<div className="arkynTableCaptionContent">`.
|
|
627
|
+
- Props: none beyond `<caption>` attributes.
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
## Calendars & media
|
|
632
|
+
|
|
633
|
+
### Calendar
|
|
634
|
+
- Import: `import { Calendar } from "@arkyn/components/calendar";`
|
|
635
|
+
- Styles: `import "@arkyn/components/calendar.css";`
|
|
636
|
+
- Extends: no native element — discriminated union `SingleCalendarProps | RangeCalendarProps` on `type`
|
|
637
|
+
- Notable: manages navigation state internally via its own provider.
|
|
638
|
+
- Props (common):
|
|
639
|
+
- `type: "single" | "range"` — required.
|
|
640
|
+
- `variant?: "basic" | "complete"` — `basic` = simplified header. Default: `"complete"`.
|
|
641
|
+
- `viewValue?: Date` / `defaultViewValue?: Date`
|
|
642
|
+
- `onChangeView?: (date: Date) => void`
|
|
643
|
+
- When `type: "single"`: `value?: Date`, `defaultValue?: Date`, `onChange?: (date: Date) => void`.
|
|
644
|
+
- When `type: "range"`: `value?: [Date, Date]`, `defaultValue?: [Date, Date]`, `onChange?: (date: [Date, Date]) => void`.
|
|
645
|
+
|
|
646
|
+
### DatePicker
|
|
647
|
+
- Import: `import { DatePicker } from "@arkyn/components/datePicker";`
|
|
648
|
+
- Styles: `import "@arkyn/components/datePicker.css";`
|
|
649
|
+
- Extends: no native element — discriminated union `SingleDatePickerProps | RangeDatePickerProps` on `type`
|
|
650
|
+
- Notable: opens a popover `Calendar` (same flip-based positioning as `Select`'s options list). **Missing from README.md — it's a real public export, don't skip it.**
|
|
651
|
+
- Requires context: reads `useForm()` optionally.
|
|
652
|
+
- Props (common):
|
|
653
|
+
- `name: string` — required.
|
|
654
|
+
- `type: "single" | "range"` — required.
|
|
655
|
+
- `id?: string` / `showAsterisk?: boolean` / `label?: string` / `errorMessage?: string`
|
|
656
|
+
- `placeholder?: string` — Default: `"Selecione uma data..."`.
|
|
657
|
+
- `className?: string`
|
|
658
|
+
- `disabled?: boolean` / `readOnly?: boolean` / `isLoading?: boolean` — default `false`.
|
|
659
|
+
- `closeOnSelect?: boolean` — Default: `true` for `single`, `false` for `range`.
|
|
660
|
+
- `onFocus?: () => void` / `onBlur?: (e: FocusEvent<HTMLDivElement>) => void`
|
|
661
|
+
- `size?: "md" | "lg"` — Default: `"md"`.
|
|
662
|
+
- `variant?: "solid" | "outline" | "underline"` — Default: `"solid"`.
|
|
663
|
+
- `prefix?: string | LucideIcon` / `leftIcon?: LucideIcon`
|
|
664
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
665
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — Default: `"vertical"`.
|
|
666
|
+
- `calendarVariant?: "basic" | "complete"` — forwarded to internal `Calendar`. Default: `"complete"`.
|
|
667
|
+
- When `type: "single"`: `value?: Date`, `defaultValue?: Date`, `onChange?: (date: Date) => void`, plus `viewValue?`/`defaultViewValue?`/`onChangeView?`.
|
|
668
|
+
- When `type: "range"`: `value?: [Date, Date]`, `defaultValue?: [Date, Date]`, `onChange?: (date: [Date, Date]) => void`, plus `viewValue?`/`defaultViewValue?`/`onChangeView?`, and `rangeSeparator?: string` (Default: `" até "`).
|
|
669
|
+
|
|
670
|
+
### FullCalendar
|
|
671
|
+
- Import: `import { FullCalendar } from "@arkyn/components/fullCalendar";`
|
|
672
|
+
- Styles: `import "@arkyn/components/fullCalendar.css";`
|
|
673
|
+
- Extends: no native element, own props only
|
|
674
|
+
- Notable: day/week/month views; internal state managed by its own internal provider.
|
|
675
|
+
- Props:
|
|
676
|
+
- `viewValue?: Date` / `defaultViewValue?: Date`
|
|
677
|
+
- `events?: FullCalendarEvent[]` — each: `{ title: string; initialDate: Date; endDate?: Date; data?: any; scheme?: "primary"|"success"|"warning"|"danger"|"info" (default "primary"); onClick?: (data: any) => void }`.
|
|
678
|
+
- `blockedTimestamps?: BlockTimestamp[]` — each: `{ initialDate: Date; endDate: Date }`.
|
|
679
|
+
- `onChangeView?: (date: Date) => void` / `onClickDate?: (date: Date) => void`
|
|
680
|
+
|
|
681
|
+
### AudioPlayer
|
|
682
|
+
- Import: `import { AudioPlayer } from "@arkyn/components/audioPlayer";`
|
|
683
|
+
- Styles: `import "@arkyn/components/audioPlayer.css";`
|
|
684
|
+
- Extends: native `<audio>` attributes minus `onEnded`, `src` (redeclared)
|
|
685
|
+
- Notable: renders play/pause, elapsed/total time (`MM:SS`), and a scrubbable `Slider` progress bar.
|
|
686
|
+
- Props:
|
|
687
|
+
- `src: string` — required.
|
|
688
|
+
- `disabled?: boolean` — Default: `false`.
|
|
689
|
+
- `onPlayAudio?: (props: AudioInformationProps) => void` / `onPauseAudio?: (props: AudioInformationProps) => void` — `AudioInformationProps`: `{ currentTime, totalTime, formattedCurrentTime, formattedTotalTime }`.
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## Maps & places
|
|
694
|
+
|
|
695
|
+
### SearchPlaces
|
|
696
|
+
- Import: `import { SearchPlaces } from "@arkyn/components/searchPlaces";`
|
|
697
|
+
- Styles: none — reuses `Input`'s styles, don't try to import `searchPlaces.css` (doesn't exist).
|
|
698
|
+
- Extends: `Input`'s props minus `onLoad`, `onChange`, `type`
|
|
699
|
+
- Requires peer dependency: `@react-google-maps/api` (`StandaloneSearchBox`). Requires the Google Maps JS API loaded (typically via `PlacesProvider`).
|
|
700
|
+
- Props:
|
|
701
|
+
- `options?: StandaloneSearchBoxProps["options"]` — e.g. `componentRestrictions`, `bounds`.
|
|
702
|
+
- `onChange?: (e: string) => void` — fires on every input change.
|
|
703
|
+
- `onPlaceChanged?: (e: PlaceData) => void` — `PlaceData`: `{ street, city, state, neighborhood, postalCode, stateShortName, streetNumber, coordinates: { lat, lng } }`.
|
|
704
|
+
|
|
705
|
+
### MapView
|
|
706
|
+
- Import: `import { MapView } from "@arkyn/components/mapView";`
|
|
707
|
+
- Styles: `import "@arkyn/components/mapView.css";`
|
|
708
|
+
- Extends: native `<div>` attributes
|
|
709
|
+
- Requires peer dependency: `mapbox-gl`.
|
|
710
|
+
- Notable: renders client-side only; shows a placeholder pin before hydration or when `coordinates` is empty.
|
|
711
|
+
- Props:
|
|
712
|
+
- `accessToken: string` — Mapbox public token. Required.
|
|
713
|
+
- `zoom?: number` — Default: `18`.
|
|
714
|
+
- `coordinates?: Coordinate | Coordinate[]` — `Coordinate`: `{ lat: number; lng: number; data?: any; popUp?: ReactNode }`.
|
|
715
|
+
- `onMarkerClick?: (coordinate: Coordinate) => void`
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
719
|
+
## Tracking (no-op outside production unless `showInDevMode`)
|
|
720
|
+
|
|
721
|
+
All three render nothing in development mode unless `showInDevMode` is `true`, and are wrapped in `ClientOnly` internally (no SSR errors). None have a `.css` subpath — they render no visible markup.
|
|
722
|
+
|
|
723
|
+
### GoogleAnalytics
|
|
724
|
+
- Import: `import { GoogleAnalytics } from "@arkyn/components/googleAnalytics";`
|
|
725
|
+
- Props:
|
|
726
|
+
- `measurementId: string` — e.g. `"G-XXXXXXXXXX"`. Required.
|
|
727
|
+
- `showInDevMode?: boolean` — Default: `false`.
|
|
728
|
+
|
|
729
|
+
### GoogleTagManager
|
|
730
|
+
- Import: `import { GoogleTagManager } from "@arkyn/components/googleTagManager";`
|
|
731
|
+
- Notable: injects both the `<script>` and `<noscript>` GTM snippets.
|
|
732
|
+
- Props:
|
|
733
|
+
- `gtmId: string` — e.g. `"GTM-XXXXXXX"`. Required.
|
|
734
|
+
- `events?: Record<string, string>` — pushed to the dataLayer on init.
|
|
735
|
+
- `dataLayer?: Record<string, string>` — initial dataLayer entries before GTM loads.
|
|
736
|
+
- `dataLayerName?: string` — Default: `"dataLayer"`.
|
|
737
|
+
- `auth?: string` / `preview?: string` — GTM environment tokens.
|
|
738
|
+
- `showInDevMode?: boolean` — Default: `false`.
|
|
739
|
+
|
|
740
|
+
### FacebookPixel
|
|
741
|
+
- Import: `import { FacebookPixel } from "@arkyn/components/facebookPixel";`
|
|
742
|
+
- Props:
|
|
743
|
+
- `pixelId: string` — required.
|
|
744
|
+
- `showInDevMode?: boolean` — Default: `false`.
|
|
745
|
+
- `options?: { autoConfig?: boolean; debug?: boolean }` — defaults `true`/`false`.
|
|
746
|
+
- `pageView?: boolean` — fires standard `PageView` on mount.
|
|
747
|
+
- `grantConsent?: boolean` / `revokeConsent?: boolean` — cookie/tracking consent via `fbq("consent", ...)`.
|
|
748
|
+
- `track?: [string, any?]` — standard event `[eventName, eventData?]`.
|
|
749
|
+
- `trackCustom?: [string, any?]` — custom event.
|
|
750
|
+
- `trackSingle?: [string, any?]` / `trackSingleCustom?: [string, any?]` — single-pixel variants.
|
|
751
|
+
|
|
752
|
+
---
|
|
753
|
+
|
|
754
|
+
## Rich text
|
|
755
|
+
|
|
756
|
+
### RichText
|
|
757
|
+
- Import: `import { RichText } from "@arkyn/components/richText";`
|
|
758
|
+
- Styles: `import "@arkyn/components/richText.css";`
|
|
759
|
+
- Extends: no native element, own `RichTextProps` type
|
|
760
|
+
- Requires peer dependencies: `slate`, `slate-history`, `slate-react`, `is-hotkey`.
|
|
761
|
+
- Notable: content stored as a Slate JSON string in a hidden `<input>` for form submission. Toolbar buttons: Heading 1, Heading 2, Block Quote, Bold, Italic, Underline, Code, Align Left/Right/Center/Justify, Insert Image (only if `imageConfig` given), Insert Video, Insert Link. Pressing Space/Enter right after a link stops new text from continuing the link.
|
|
762
|
+
- Props:
|
|
763
|
+
- `name: string` — required.
|
|
764
|
+
- `className?: string`
|
|
765
|
+
- `unShowFieldTemplate?: boolean` — Default: `false`.
|
|
766
|
+
- `orientation?: "horizontal" | "vertical" | "horizontalReverse"` — runtime default `"vertical"`.
|
|
767
|
+
- `hiddenButtons?: RichTextHiddenButtonKey[]` — e.g. `["image", "code"]`.
|
|
768
|
+
- `maxLimit?: number` — Default: `10000`.
|
|
769
|
+
- `enforceCharacterLimit?: boolean` — blocks typing past `maxLimit`. Default: `false`.
|
|
770
|
+
- `baseErrorMessage?: string` — overrides `useForm` context error.
|
|
771
|
+
- `defaultValue?: string` — Slate JSON string. Default: `"[]"`.
|
|
772
|
+
- `isError?: boolean` — forces error visual state.
|
|
773
|
+
- `id?: string` / `label?: string` / `showAsterisk?: boolean`
|
|
774
|
+
- `imageConfig?: RichTextInsertImageProps` — enables image insertion; `action: string` required inside, plus modal label overrides (`tabLabels?`, `modalTitle?`, `modalInputUrlLabel?`, `modalInputImageLabel?`, `modalCancelButton?`, `modalConfirmButton?`).
|
|
775
|
+
- `videoConfig?: RichTextInsertVideoProps` — modal label overrides (`modalTitle?`, `modalInputUrlLabel?`, `modalCancelButton?`, `modalConfirmButton?`, `invalidUrlMessage?`).
|
|
776
|
+
- `linkConfig?: RichTextInsertLinkProps` — same shape as `videoConfig`.
|
|
777
|
+
- `onChangeCharactersCount?: (e: number) => void` — fires on every keystroke.
|
|
778
|
+
- `onChange?: (value: Descendant[]) => void` — Slate `Descendant[]`.
|
|
779
|
+
|
|
780
|
+
Convert between this editor's value and HTML with the `toHtml`/`toRichTextValue` services below.
|
|
781
|
+
|
|
782
|
+
---
|
|
783
|
+
|
|
784
|
+
## SSR safety
|
|
785
|
+
|
|
786
|
+
### ClientOnly
|
|
787
|
+
- Import: `import { ClientOnly } from "@arkyn/components/clientOnly";`
|
|
788
|
+
- Styles: none — renders no markup of its own, `clientOnly.css` doesn't exist.
|
|
789
|
+
- Extends: no native element, own props only
|
|
790
|
+
- Notable: prevents hydration mismatches for components relying on `window`/`navigator`/`document`; uses `useHydrated` internally.
|
|
791
|
+
- Props:
|
|
792
|
+
- `children(): React.ReactNode` — render function called after hydration. Required (a function, not a plain node).
|
|
793
|
+
- `fallback?: React.ReactNode` — rendered during SSR/before hydration. Default: `null`.
|
|
794
|
+
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
## Hooks
|
|
798
|
+
|
|
799
|
+
### useForm
|
|
800
|
+
- Import: `import { useForm } from "@arkyn/components/useForm";`
|
|
801
|
+
- Signature: `useForm(): { fieldErrors: { [x: string]: any } }`
|
|
802
|
+
- Requires: intended for use inside `FormProvider`, but does **not** throw if missing (unlike `useModal`/`useDrawer`/`useToast`) — just returns the default empty context, so `fieldErrors` would be `undefined`.
|
|
803
|
+
|
|
804
|
+
### useModal
|
|
805
|
+
- Import: `import { useModal } from "@arkyn/components/useModal";`
|
|
806
|
+
- Signature (no key): `useModal<T = any>(): { modalIsOpen(key): boolean; modalData(key): T; openModal(key, data?): void; closeModal(key): void; closeAll(): void }`
|
|
807
|
+
- Signature (with key): `useModal<T = any>(key: string): { modalIsOpen: boolean; modalData: T; openModal: (data?: T) => void; closeModal: () => void }` — note `closeAll` is only on the no-key form.
|
|
808
|
+
- Requires: must be inside `ModalProvider` — throws `"useModal must be used within a Provider"` otherwise.
|
|
809
|
+
|
|
810
|
+
### useDrawer
|
|
811
|
+
- Import: `import { useDrawer } from "@arkyn/components/useDrawer";`
|
|
812
|
+
- Signature (no key): `useDrawer<T = any>(): { drawerIsOpen(key): boolean; drawerData(key): T; openDrawer(key, data?): void; closeDrawer(key): void }`
|
|
813
|
+
- Signature (with key): `useDrawer<T = any>(key: string): { drawerIsOpen: boolean; drawerData: T; openDrawer: (data?: T) => void; closeDrawer: () => void }`
|
|
814
|
+
- Requires: must be inside `DrawerProvider` — throws `"useDrawer must be used within a Provider"` otherwise. (No `closeAll` equivalent, unlike `useModal`.)
|
|
815
|
+
|
|
816
|
+
### useToast
|
|
817
|
+
- Import: `import { useToast } from "@arkyn/components/useToast";`
|
|
818
|
+
- Signature: `useToast(): { showToast(toast: { message: string; type: "success" | "danger" }): void }`
|
|
819
|
+
- Requires: must be inside `ToastProvider` — throws `"useToast must be used within a Provider"` otherwise.
|
|
820
|
+
|
|
821
|
+
### useSlider
|
|
822
|
+
- Import: `import { useSlider } from "@arkyn/components/useSlider";`
|
|
823
|
+
- Signature: `useSlider(defaultValue?: number): [sliderValue: number, changeSliderValue: (value: number) => void]`
|
|
824
|
+
- Notable: value is clamped to `[0, 100]` both on init (default `0`) and on every update.
|
|
825
|
+
|
|
826
|
+
### useHydrated
|
|
827
|
+
- Import: `import { useHydrated } from "@arkyn/components/useHydrated";`
|
|
828
|
+
- Signature: `useHydrated(): boolean`
|
|
829
|
+
- Notable: `true` once hydrated client-side, `false` during SSR. Built on `useSyncExternalStore`.
|
|
830
|
+
|
|
831
|
+
### useScopedParams
|
|
832
|
+
- Import: `import { useScopedParams } from "@arkyn/components/useScopedParams";`
|
|
833
|
+
- Signature: `useScopedParams(searchString: string, scope?: string = ""): { getParam: (key: string) => string | null; getScopedSearch: (params: Record<string, string|number|boolean|undefined>) => string }`
|
|
834
|
+
- Notable: does not read `location.search` itself — you pass the search string in. `getScopedSearch` deletes a key when its value is `undefined`; returns `""` if no params remain, otherwise a `?`-prefixed string.
|
|
835
|
+
|
|
836
|
+
### useScrollLock
|
|
837
|
+
- Import: `import { useScrollLock } from "@arkyn/components/useScrollLock";`
|
|
838
|
+
- Signature: `useScrollLock(isLocked: boolean): void`
|
|
839
|
+
- Notable: while locked, sets `document.body.style.overflow = "hidden"` and pads `paddingRight` by the scrollbar width to prevent layout shift; used internally by `ModalContainer`/`DrawerContainer`.
|
|
840
|
+
|
|
841
|
+
### useAutomation
|
|
842
|
+
- Import: `import { useAutomation } from "@arkyn/components/useAutomation";`
|
|
843
|
+
- Signature: `useAutomation(formResponseData: any): void`
|
|
844
|
+
- Requires: must be inside both `ModalProvider` and `ToastProvider` (calls `useModal()`/`useToast()` internally, both throw if missing). Also needs `react-scroll` peer dep.
|
|
845
|
+
- Notable: side-effect only — reads a server-action response shape (`{ name, message, cause }`) and: closes all modals if `closeModal` is truthy, smooth-scrolls if `cause.data.scrollTo` is set, and fires a success/danger toast based on `name` matching known success/error response names.
|
|
846
|
+
|
|
847
|
+
### useSearchAutomation
|
|
848
|
+
- Import: `import { useSearchAutomation } from "@arkyn/components/useSearchAutomation";`
|
|
849
|
+
- Signature: `useSearchAutomation(searchString: string, scope?: string = ""): void`
|
|
850
|
+
- Requires: same as `useAutomation` (`ModalProvider` + `ToastProvider`), plus `react-scroll`.
|
|
851
|
+
- Notable: URL-driven sibling of `useAutomation` — reads `closeModal`/`message`/`name`/`type` from scoped URL params instead of a response object.
|
|
852
|
+
|
|
853
|
+
### useCopyToClipboard
|
|
854
|
+
- Import: `import { useCopyToClipboard } from "@arkyn/components/useCopyToClipboard";`
|
|
855
|
+
- Signature: `useCopyToClipboard(): { copyToClipboard: (text: string) => Promise<boolean> }`
|
|
856
|
+
- Notable: tries `navigator.clipboard.writeText` first, falls back to a hidden `<textarea>` + `document.execCommand("copy")`. Never throws — resolves `false` on any failure.
|
|
857
|
+
|
|
858
|
+
---
|
|
859
|
+
|
|
860
|
+
## Providers
|
|
861
|
+
|
|
862
|
+
### FormProvider
|
|
863
|
+
- Import: `import { FormProvider } from "@arkyn/components/formProvider";`
|
|
864
|
+
- Props: `children: ReactNode` (required); `fieldErrors?: any` — map of field name → error message, typically from Zod/server validation; `form?: React.ReactElement` — if given, cloned and `children` placed inside it (e.g. wrap a Remix `<Form>`).
|
|
865
|
+
- Exposes (via `useForm`): `fieldErrors`.
|
|
866
|
+
|
|
867
|
+
### ModalProvider
|
|
868
|
+
- Import: `import { ModalProvider } from "@arkyn/components/modalProvider";`
|
|
869
|
+
- Props: `children: ReactNode` (required).
|
|
870
|
+
- Exposes (via `useModal`): `modalIsOpen(key)`, `modalData(key)`, `openModal(key, data?)` (replaces existing entry for that key), `closeModal(key)`, `closeAll()`.
|
|
871
|
+
|
|
872
|
+
### DrawerProvider
|
|
873
|
+
- Import: `import { DrawerProvider } from "@arkyn/components/drawerProvider";`
|
|
874
|
+
- Props: `children: ReactNode` (required).
|
|
875
|
+
- Exposes (via `useDrawer`): `drawerIsOpen(key)`, `drawerData(key)`, `openDrawer(key, data?)`, `closeDrawer(key)`. No `closeAll` (unlike `ModalProvider`).
|
|
876
|
+
|
|
877
|
+
### ToastProvider
|
|
878
|
+
- Import: `import { ToastProvider } from "@arkyn/components/toastProvider";`
|
|
879
|
+
- Props: `children: ReactNode` (required).
|
|
880
|
+
- Exposes (via `useToast`): `showToast({ message, type: "success" | "danger" })`.
|
|
881
|
+
- Notable: also renders a `react-hot-toast` `<Toaster position="top-right">` alongside `children` — don't render your own `Toaster` too.
|
|
882
|
+
|
|
883
|
+
### PlacesProvider
|
|
884
|
+
- Import: `import { PlacesProvider } from "@arkyn/components/placesProvider";`
|
|
885
|
+
- Props: `apiKey: string` (required, Google Maps API key); `children: (isLoaded: boolean) => ReactNode` (required — **render-prop, not plain children**); `preventFontsLoading?: boolean` (default `true`).
|
|
886
|
+
- Notable: no matching custom hook — unlike Modal/Drawer/Toast/Form, `isLoaded` is only available through the render-prop callback, not via context.
|
|
887
|
+
|
|
888
|
+
---
|
|
889
|
+
|
|
890
|
+
## Services
|
|
891
|
+
|
|
892
|
+
### toHtml
|
|
893
|
+
- Import: `import { toHtml } from "@arkyn/components/toHtml";`
|
|
894
|
+
- Signature: `toHtml(richTextValue: RichTextValue): string`
|
|
895
|
+
- Converts a `RichText` editor's Slate `Descendant[]` value into an HTML string.
|
|
896
|
+
|
|
897
|
+
### toRichTextValue
|
|
898
|
+
- Import: `import { toRichTextValue } from "@arkyn/components/toRichTextValue";`
|
|
899
|
+
- Requires peer dependency: `html-react-parser`.
|
|
900
|
+
- Signature: `toRichTextValue(html: string): RichTextValue`
|
|
901
|
+
- Converts an HTML string into a `RichText` editor's `defaultValue` (Slate `Descendant[]`).
|
|
902
|
+
|
|
903
|
+
## Related packages
|
|
904
|
+
|
|
905
|
+
- `@arkyn/shared` — formatting/validation utilities used alongside these components (e.g. `formatToCpf` for display, independent of `MaskedInput`'s input-time masking).
|
|
906
|
+
- `@arkyn/templates` — `countries`/`brazilianStates` shape matches `Select`/`MultiSelect`'s `options` prop directly; `PhoneInput` uses it internally for country masks.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkyn/components",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
40
40
|
"README.md",
|
|
41
|
+
"AGENTS.md",
|
|
41
42
|
"LICENSE.txt",
|
|
42
43
|
"styles.d.ts"
|
|
43
44
|
],
|