@reformer/ui-kit 7.0.0 → 9.0.0-beta.1

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/llms.txt CHANGED
@@ -435,7 +435,6 @@ import { Textarea } from '@reformer/ui-kit';
435
435
  - [03-choice-fields.md](03-choice-fields.md) — Select, Checkbox, RadioGroup.
436
436
  - [05-form-field-integration.md](05-form-field-integration.md) — как все эти поля автоматически подключаются через `FormField`.
437
437
  - [06-troubleshooting.md](06-troubleshooting.md) — «number возвращает строку», «mask пропускает символы», «password toggle не появляется».
438
- - Эталон: `examples/registration-form/RegistrationForm.tsx`, `examples/complex-multy-step-form/schemas/schema.ts` (monorepo examples).
439
438
 
440
439
  ## 12. Checkbox
441
440
 
@@ -801,7 +800,6 @@ const form = createForm<{ city: string }>({ model, schema });
801
800
  - [02-text-fields.md](02-text-fields.md) — `Input`, `InputMask`, `InputPassword`, `Textarea`.
802
801
  - [05-form-field-integration.md](05-form-field-integration.md) — `FormField` распознаёт `Checkbox` и не дублирует label.
803
802
  - [06-troubleshooting.md](06-troubleshooting.md) — «Select не показывает options», «options vs resource», «onBlur не срабатывает на Select/RadioGroup».
804
- - Эталон: `examples/complex-multy-step-form/schemas/schema.ts` (monorepo example) — большой пример с `Select` и `Checkbox` в реальной форме.
805
803
 
806
804
  ## 16. Button
807
805
 
@@ -1205,8 +1203,6 @@ function CreditApplicationPage() {
1205
1203
  }
1206
1204
  ```
1207
1205
 
1208
- Эталон: `examples/complex-multy-step-form-renderer/CreditApplicationFormRenderer.tsx` (monorepo example).
1209
-
1210
1206
  `testId` рендерер берёт из `componentProps.testId` листа schema:
1211
1207
 
1212
1208
  ```tsx
@@ -1298,7 +1294,6 @@ const form = createForm<{ accept: boolean }>({ model, schema });
1298
1294
  - [04-layout-and-buttons.md](04-layout-and-buttons.md) — `Button` для submit/prev/next.
1299
1295
  - [06-troubleshooting.md](06-troubleshooting.md) — «label дублируется», «error не появляется», «FormField не подцепляет ошибки».
1300
1296
  - CDK-хуки: [@reformer/cdk/form-field](../../../reformer-cdk/docs/llms/) (`FormField.Root`, `useFormFieldContext`).
1301
- - Эталон: `examples/complex-multy-step-form-renderer/CreditApplicationFormRenderer.tsx` (monorepo example) — `FormField` как `fieldWrapper` целой multi-step формы.
1302
1297
 
1303
1298
  ## 25. 1. `Input type="number"` возвращает строку, а не число (или `null`)
1304
1299
 
@@ -1680,14 +1675,7 @@ const handleSubmit = async () => {
1680
1675
  > **`config` не привязан к типу формы.** `FormWizardConfig` — это `{ validateStep?, validateAll? }`,
1681
1676
  > оба колбэка возвращают `boolean | Promise<boolean>`. Канон M1 — прогонять
1682
1677
  > `validateFormModel(model, schema)` (именно он исполняет `validators` листьев;
1683
- > `form.validate()` по нодам схемные правила НЕ запустит). См. эталон
1684
- > `examples/complex-multy-step-form/schemas/validation.ts`. Реальный эталон собирает конфиг фабрикой:
1685
- >
1686
- > ```tsx
1687
- > import { makeCreditValidationConfig } from './schemas/validation';
1688
- > const config = useMemo(() => makeCreditValidationConfig(model), [model]);
1689
- > // → { validateStep: (step) => Promise<boolean>, validateAll: () => Promise<boolean> }
1690
- > ```
1678
+ > `form.validate()` по нодам схемные правила НЕ запустит).
1691
1679
 
1692
1680
  ### Альтернатива — imperative submit с values
1693
1681
 
@@ -1914,7 +1902,7 @@ const renderSchema = createRenderSchema<CreditApplication>(() => ({
1914
1902
 
1915
1903
  ui-kit FormArraySection маркирован `__selfManagedChildren = true` — родитель-renderer пробрасывает `form` без рекурсии.
1916
1904
 
1917
- > Альтернатива — нативный array-узел движка `{ array: model.properties, initialValue, item: (im) => ({ children: [ { value: im.$.field, component } ] }) }` (см. эталон `examples/complex-multy-step-form-renderer/render-schema.ts`).
1905
+ > Альтернатива — нативный array-узел движка `{ array: model.properties, initialValue, item: (im) => ({ children: [ { value: im.$.field, component } ] }) }`.
1918
1906
 
1919
1907
  ## 45. JSON (renderer-json)
1920
1908
 
@@ -2118,7 +2106,7 @@ const onSubmit = async () => {
2118
2106
 
2119
2107
  Cross-field правила (например, «доп. телефон отличается от основного») — это
2120
2108
  именованные `ModelValidator<value, scope, root>` в том же массиве `validators`
2121
- (читают корень формы через третий аргумент). Эталон: `examples/complex-multy-step-form/schemas/validation.ts`.
2109
+ (читают корень формы через третий аргумент).
2122
2110
 
2123
2111
  ## 51. Advanced — strict mask через FormField + children slot
2124
2112
 
@@ -2410,7 +2398,7 @@ Props компонента {@link Checkbox}.
2410
2398
  ```typescript
2411
2399
  export interface CheckboxProps extends Omit<
2412
2400
  React.InputHTMLAttributes<HTMLInputElement>,
2413
- 'value' | 'onChange' | 'type'
2401
+ 'value' | 'onChange' | 'type' | 'checked' | 'defaultChecked'
2414
2402
  > {
2415
2403
  /** Дополнительный CSS-класс для самого input. */
2416
2404
  className?: string;
@@ -2595,6 +2583,28 @@ return <ErrorState error={error} onRetry={() => window.location.reload()} />;
2595
2583
 
2596
2584
  _Source: src/components/state/error-state.tsx_
2597
2585
 
2586
+ ### ErrorStateProps
2587
+
2588
+ **Kind:** `interface`
2589
+
2590
+ **Signature:**
2591
+ ```typescript
2592
+ export interface ErrorStateProps {
2593
+ /** Текст ошибки, показывается под заголовком. */
2594
+ error: string;
2595
+ /** Заголовок блока ошибки. По умолчанию `'Ошибка загрузки'`. */
2596
+ title?: string;
2597
+ /** Колбэк повторной попытки. Если задан — рендерится кнопка «Повторить». */
2598
+ onRetry?: () => void;
2599
+ /** Подпись кнопки повтора. По умолчанию `'Повторить'`. */
2600
+ retryLabel?: string;
2601
+ /** Внешний CSS-класс контейнера. По умолчанию `'w-full'`. */
2602
+ className?: string;
2603
+ }
2604
+ ```
2605
+
2606
+ _Source: src/components/state/error-state.tsx_
2607
+
2598
2608
  ### ExampleCard
2599
2609
 
2600
2610
  **Kind:** `function`
@@ -3199,7 +3209,7 @@ import { Input } from '@reformer/ui-kit';
3199
3209
  <Input
3200
3210
  type="number"
3201
3211
  value={age}
3202
- onChange={(v) => setAge(v as number | null)}
3212
+ onChange={setAge}
3203
3213
  min={0}
3204
3214
  placeholder="Возраст"
3205
3215
  />
@@ -3217,7 +3227,7 @@ return (
3217
3227
  type="email"
3218
3228
  value={value}
3219
3229
  disabled={disabled}
3220
- onChange={(v) => control.setValue((v ?? '') as string)}
3230
+ onChange={(v) => control.setValue(v ?? '')}
3221
3231
  onBlur={() => control.markAsTouched()}
3222
3232
  aria-invalid={shouldShowError}
3223
3233
  placeholder={shouldShowError ? errors[0]?.message : 'you@example.com'}
@@ -3278,7 +3288,7 @@ Props компонента {@link InputMask}.
3278
3288
  ```typescript
3279
3289
  export interface InputMaskProps extends Omit<
3280
3290
  React.InputHTMLAttributes<HTMLInputElement>,
3281
- 'value' | 'onChange'
3291
+ 'value' | 'onChange' | 'defaultValue'
3282
3292
  > {
3283
3293
  /** Дополнительный CSS-класс. */
3284
3294
  className?: string;
@@ -3353,7 +3363,7 @@ Props компонента {@link InputPassword}.
3353
3363
  ```typescript
3354
3364
  export interface InputPasswordProps extends Omit<
3355
3365
  React.InputHTMLAttributes<HTMLInputElement>,
3356
- 'value' | 'onChange' | 'type'
3366
+ 'value' | 'onChange' | 'type' | 'defaultValue'
3357
3367
  > {
3358
3368
  /** Дополнительный CSS-класс. */
3359
3369
  className?: string;
@@ -3379,39 +3389,14 @@ _Source: src/components/ui/input-password.tsx_
3379
3389
 
3380
3390
  ### InputProps
3381
3391
 
3382
- **Kind:** `interface`
3392
+ **Kind:** `type`
3383
3393
 
3384
- Props компонента {@link Input}.
3394
+ Props компонента {@link Input} — дискриминированный union по `type`:
3395
+ `type="number"` даёт `number | null` для `value`/`onChange`, любой другой `type` — `string | null`.
3385
3396
 
3386
3397
  **Signature:**
3387
3398
  ```typescript
3388
- export interface InputProps extends Omit<
3389
- React.InputHTMLAttributes<HTMLInputElement>,
3390
- 'value' | 'onChange'
3391
- > {
3392
- /** Дополнительный CSS-класс (мерджится с дефолтными Tailwind-классами через `tailwind-merge`). */
3393
- className?: string;
3394
- /**
3395
- * Текущее значение поля. Для `type='number'` ожидается `number | null`,
3396
- * для остальных — `string | null`. `null`/`undefined` рендерится как пустое поле.
3397
- */
3398
- value?: string | number | null;
3399
- /**
3400
- * Обработчик изменений. Получает уже распарсенное значение:
3401
- * - для `type='number'` — `number` или `null` (для пустой строки),
3402
- * - иначе — `string` или `null`.
3403
- * `NaN` не прокидывается. При `min >= 0` отрицательные значения превращаются в `0`.
3404
- */
3405
- onChange?: (value: string | number | null) => void;
3406
- /** Срабатывает при потере фокуса. Используется `FormField` для пометки `touched`. */
3407
- onBlur?: () => void;
3408
- /** HTML-тип input. Для `'number'` включается специальный парсинг значения. */
3409
- type?: 'text' | 'email' | 'number' | 'tel' | 'url' | 'password';
3410
- /** Подсказка внутри поля. */
3411
- placeholder?: string;
3412
- /** Блокирует ввод и редактирование. */
3413
- disabled?: boolean;
3414
- }
3399
+ export type InputProps = NumberInputProps | TextInputProps;
3415
3400
  ```
3416
3401
 
3417
3402
  _Source: src/components/ui/input.tsx_
@@ -3449,6 +3434,24 @@ return <LoadingState />;
3449
3434
 
3450
3435
  _Source: src/components/state/loading-state.tsx_
3451
3436
 
3437
+ ### LoadingStateProps
3438
+
3439
+ **Kind:** `interface`
3440
+
3441
+ **Signature:**
3442
+ ```typescript
3443
+ export interface LoadingStateProps {
3444
+ /** Основной текст. По умолчанию `'Загрузка данных...'`. */
3445
+ title?: string;
3446
+ /** Вспомогательный текст под спиннером. По умолчанию `'Пожалуйста, подождите'`. */
3447
+ subtitle?: string;
3448
+ /** Внешний CSS-класс контейнера. По умолчанию центрирует спиннер с отступами. */
3449
+ className?: string;
3450
+ }
3451
+ ```
3452
+
3453
+ _Source: src/components/state/loading-state.tsx_
3454
+
3452
3455
  ### RadioGroup
3453
3456
 
3454
3457
  **Kind:** `const`
@@ -3515,6 +3518,12 @@ export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElemen
3515
3518
  options: RadioOption[];
3516
3519
  /** Блокирует все варианты. */
3517
3520
  disabled?: boolean;
3521
+ /**
3522
+ * Общий `name` для всех radio группы — обеспечивает нативный одиночный выбор и
3523
+ * навигацию стрелками между вариантами. Если не задан, выводится из `id` /
3524
+ * `data-testid`, а в крайнем случае генерируется автоматически.
3525
+ */
3526
+ name?: string;
3518
3527
  /** Test-id (используется как для контейнера, так и как префикс для каждого radio). */
3519
3528
  'data-testid'?: string;
3520
3529
  }
@@ -3899,7 +3908,7 @@ Props компонента {@link Select}.
3899
3908
 
3900
3909
  **Signature:**
3901
3910
  ```typescript
3902
- export interface SelectProps<T> extends Omit<
3911
+ export interface SelectProps extends Omit<
3903
3912
  React.ComponentProps<typeof SelectPrimitive.Root>,
3904
3913
  'value' | 'onValueChange'
3905
3914
  > {
@@ -3912,7 +3921,7 @@ export interface SelectProps<T> extends Omit<
3912
3921
  /** Срабатывает при закрытии дропдауна (через `onOpenChange(false)`). */
3913
3922
  onBlur?: () => void;
3914
3923
  /** Асинхронный источник опций. Если задан вместе с `options`, приоритет у `options`. */
3915
- resource?: ResourceConfig<T>;
3924
+ resource?: ResourceConfig<unknown>;
3916
3925
  /**
3917
3926
  * Inline-варианты. `value` приводится к строке. Опции с одинаковым `group`
3918
3927
  * объединяются в `SelectGroup` с `SelectLabel` (см. рецепт grouped options).
@@ -4016,6 +4025,7 @@ function SelectTrigger({
4016
4025
  size = 'default',
4017
4026
  children,
4018
4027
  'aria-label': ariaLabel,
4028
+ 'aria-labelledby': ariaLabelledBy,
4019
4029
  ...props
4020
4030
  }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
4021
4031
  size?: 'sm' | 'default';
@@ -4163,7 +4173,7 @@ Props компонента {@link Textarea}.
4163
4173
  ```typescript
4164
4174
  export interface TextareaProps extends Omit<
4165
4175
  React.TextareaHTMLAttributes<HTMLTextAreaElement>,
4166
- 'value' | 'onChange'
4176
+ 'value' | 'onChange' | 'defaultValue'
4167
4177
  > {
4168
4178
  /** Дополнительный CSS-класс. */
4169
4179
  className?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reformer/ui-kit",
3
- "version": "7.0.0",
3
+ "version": "9.0.0-beta.1",
4
4
  "description": "Styled form components with Tailwind CSS and Radix UI for @reformer ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,8 +20,8 @@
20
20
  "import": "./dist/form-wizard.js"
21
21
  },
22
22
  "./form-field": {
23
- "types": "./dist/form-field.d.ts",
24
- "import": "./dist/form-field.js"
23
+ "types": "./dist/ui/form-field.d.ts",
24
+ "import": "./dist/ui/form-field.js"
25
25
  },
26
26
  "./input": {
27
27
  "types": "./dist/ui/input.d.ts",
@@ -121,23 +121,22 @@
121
121
  "llms.txt"
122
122
  ],
123
123
  "peerDependencies": {
124
- "@radix-ui/react-select": "^2.0.0",
125
- "@radix-ui/react-slot": "^1.0.0",
126
124
  "@reformer/cdk": ">=1.0.0",
127
125
  "@reformer/core": ">=1.1.0",
128
126
  "@reformer/renderer-react": ">=1.0.0",
129
- "lucide-react": ">=0.400.0 <1.0.0",
130
127
  "react": "^18.0.0 || ^19.0.0",
131
128
  "react-dom": "^18.0.0 || ^19.0.0"
132
129
  },
133
130
  "dependencies": {
131
+ "@radix-ui/react-select": "^2.2.6",
132
+ "@radix-ui/react-slot": "^1.2.4",
134
133
  "class-variance-authority": "^0.7.0",
135
134
  "clsx": "^2.0.0",
136
- "tailwind-merge": "^2.0.0 || ^3.0.0"
135
+ "lucide-react": "^0.553.0",
136
+ "tailwind-merge": "^2.0.0 || ^3.0.0",
137
+ "tslib": "^2.6.0"
137
138
  },
138
139
  "devDependencies": {
139
- "@radix-ui/react-select": "^2.2.6",
140
- "@radix-ui/react-slot": "^1.2.4",
141
140
  "@reformer/cdk": "*",
142
141
  "@reformer/core": "*",
143
142
  "@reformer/renderer-react": "*",
@@ -148,7 +147,6 @@
148
147
  "@vitest/utils": "^4.0.8",
149
148
  "class-variance-authority": "^0.7.1",
150
149
  "clsx": "^2.1.1",
151
- "lucide-react": "^0.553.0",
152
150
  "react": "^19.2.1",
153
151
  "react-dom": "^19.2.1",
154
152
  "tailwind-merge": "^3.4.0",
@@ -1,38 +0,0 @@
1
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
- import { Button as i } from "./ui/button.js";
3
- function o({
4
- error: r,
5
- title: d = "Ошибка загрузки",
6
- onRetry: t,
7
- retryLabel: l = "Повторить",
8
- className: s
9
- }) {
10
- return /* @__PURE__ */ e("div", { "data-testid": "error-state", className: s ?? "w-full", children: /* @__PURE__ */ a("div", { className: "bg-red-50 border border-red-200 rounded-lg p-6 text-center space-y-4", children: [
11
- /* @__PURE__ */ e("div", { className: "text-red-600 text-5xl", children: "!" }),
12
- /* @__PURE__ */ e("div", { className: "text-xl font-semibold text-red-800", children: d }),
13
- /* @__PURE__ */ e("div", { className: "text-red-700", children: r }),
14
- t && /* @__PURE__ */ e(i, { onClick: t, children: l })
15
- ] }) });
16
- }
17
- function m({
18
- title: r = "Загрузка данных...",
19
- subtitle: d = "Пожалуйста, подождите",
20
- className: t
21
- }) {
22
- return /* @__PURE__ */ e(
23
- "div",
24
- {
25
- "data-testid": "loading-state",
26
- className: t ?? "w-full flex items-center justify-center p-12",
27
- children: /* @__PURE__ */ a("div", { className: "text-center space-y-4", children: [
28
- /* @__PURE__ */ e("div", { className: "inline-block h-12 w-12 animate-spin rounded-full border-4 border-solid border-blue-600 border-r-transparent" }),
29
- /* @__PURE__ */ e("div", { className: "text-lg text-gray-600", children: r }),
30
- /* @__PURE__ */ e("div", { className: "text-sm text-gray-500", children: d })
31
- ] })
32
- }
33
- );
34
- }
35
- export {
36
- o as E,
37
- m as L
38
- };