@phpsoftbox/react-softbox 0.1.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/LICENSE +21 -0
- package/README.md +271 -0
- package/dist/components/Alert/Alert.d.ts +11 -0
- package/dist/components/Alert/Alert.js +15 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/Alert/Alert.module.css +73 -0
- package/dist/components/Badge/Badge.d.ts +8 -0
- package/dist/components/Badge/Badge.js +15 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/Badge.module.css +47 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +24 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +15 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.module.css +55 -0
- package/dist/components/Button/Button.d.ts +10 -0
- package/dist/components/Button/Button.js +37 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.module.css +130 -0
- package/dist/components/Card/Card.d.ts +15 -0
- package/dist/components/Card/Card.js +26 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/Card.module.css +55 -0
- package/dist/components/CollapseButton/CollapseButton.d.ts +9 -0
- package/dist/components/CollapseButton/CollapseButton.js +11 -0
- package/dist/components/CollapseButton/CollapseButton.js.map +1 -0
- package/dist/components/CollapseButton/CollapseButton.module.css +57 -0
- package/dist/components/Drawer/Drawer.d.ts +19 -0
- package/dist/components/Drawer/Drawer.js +42 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Drawer/Drawer.module.css +104 -0
- package/dist/components/Flex/Flex.module.css +11 -0
- package/dist/components/Flex/Row.d.ts +9 -0
- package/dist/components/Flex/Row.js +14 -0
- package/dist/components/Flex/Row.js.map +1 -0
- package/dist/components/Flex/Stack.d.ts +8 -0
- package/dist/components/Flex/Stack.js +13 -0
- package/dist/components/Flex/Stack.js.map +1 -0
- package/dist/components/Grid/Grid.d.ts +11 -0
- package/dist/components/Grid/Grid.js +16 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Grid/Grid.module.css +32 -0
- package/dist/components/Input/DatePicker.d.ts +6 -0
- package/dist/components/Input/DatePicker.js +6 -0
- package/dist/components/Input/DatePicker.js.map +1 -0
- package/dist/components/Input/DateRangePicker.d.ts +16 -0
- package/dist/components/Input/DateRangePicker.js +16 -0
- package/dist/components/Input/DateRangePicker.js.map +1 -0
- package/dist/components/Input/Field.d.ts +5 -0
- package/dist/components/Input/Field.js +25 -0
- package/dist/components/Input/Field.js.map +1 -0
- package/dist/components/Input/FloatLabel/FloatLabel.d.ts +9 -0
- package/dist/components/Input/FloatLabel/FloatLabel.js +22 -0
- package/dist/components/Input/FloatLabel/FloatLabel.js.map +1 -0
- package/dist/components/Input/FloatLabel/FloatLabel.module.css +41 -0
- package/dist/components/Input/FormField/FormField.d.ts +29 -0
- package/dist/components/Input/FormField/FormField.js +60 -0
- package/dist/components/Input/FormField/FormField.js.map +1 -0
- package/dist/components/Input/FormField/FormField.module.css +30 -0
- package/dist/components/Input/Input.d.ts +59 -0
- package/dist/components/Input/Input.js +34 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Input/Input.module.css +31 -0
- package/dist/components/Input/InputGroup.d.ts +11 -0
- package/dist/components/Input/InputGroup.js +25 -0
- package/dist/components/Input/InputGroup.js.map +1 -0
- package/dist/components/Input/InputGroup.module.css +38 -0
- package/dist/components/Input/MaskedInput.d.ts +9 -0
- package/dist/components/Input/MaskedInput.js +82 -0
- package/dist/components/Input/MaskedInput.js.map +1 -0
- package/dist/components/Input/NumberInput.d.ts +10 -0
- package/dist/components/Input/NumberInput.js +44 -0
- package/dist/components/Input/NumberInput.js.map +1 -0
- package/dist/components/Input/Radio/Radio.d.ts +7 -0
- package/dist/components/Input/Radio/Radio.js +9 -0
- package/dist/components/Input/Radio/Radio.js.map +1 -0
- package/dist/components/Input/Radio/Radio.module.css +83 -0
- package/dist/components/Input/Select/Select.d.ts +38 -0
- package/dist/components/Input/Select/Select.js +200 -0
- package/dist/components/Input/Select/Select.js.map +1 -0
- package/dist/components/Input/Select/Select.module.css +194 -0
- package/dist/components/Input/Switch/Switch.d.ts +6 -0
- package/dist/components/Input/Switch/Switch.js +9 -0
- package/dist/components/Input/Switch/Switch.js.map +1 -0
- package/dist/components/Input/Switch/Switch.module.css +62 -0
- package/dist/components/Input/Textarea/Textarea.d.ts +6 -0
- package/dist/components/Input/Textarea/Textarea.js +21 -0
- package/dist/components/Input/Textarea/Textarea.js.map +1 -0
- package/dist/components/Input/Textarea/Textarea.module.css +39 -0
- package/dist/components/Input/TimePicker.d.ts +4 -0
- package/dist/components/Input/TimePicker.js +6 -0
- package/dist/components/Input/TimePicker.js.map +1 -0
- package/dist/components/Menu/Dropdown.d.ts +13 -0
- package/dist/components/Menu/Dropdown.js +58 -0
- package/dist/components/Menu/Dropdown.js.map +1 -0
- package/dist/components/Menu/Menu.d.ts +31 -0
- package/dist/components/Menu/Menu.js +161 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/Menu.module.css +240 -0
- package/dist/components/Modal/Modal.d.ts +12 -0
- package/dist/components/Modal/Modal.js +31 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/Modal.module.css +90 -0
- package/dist/components/Notifier/Notifier.d.ts +17 -0
- package/dist/components/Notifier/Notifier.js +210 -0
- package/dist/components/Notifier/Notifier.js.map +1 -0
- package/dist/components/Notifier/Notifier.module.css +182 -0
- package/dist/components/Pagination/Pagination.d.ts +28 -0
- package/dist/components/Pagination/Pagination.js +70 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/Pagination.module.css +93 -0
- package/dist/components/Progress/Progress.d.ts +16 -0
- package/dist/components/Progress/Progress.js +32 -0
- package/dist/components/Progress/Progress.js.map +1 -0
- package/dist/components/Progress/Progress.module.css +110 -0
- package/dist/components/Tabs/Tabs.d.ts +20 -0
- package/dist/components/Tabs/Tabs.js +115 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/Tabs.module.css +101 -0
- package/dist/components/Typography/Heading.d.ts +13 -0
- package/dist/components/Typography/Heading.js +38 -0
- package/dist/components/Typography/Heading.js.map +1 -0
- package/dist/components/Typography/Text.d.ts +20 -0
- package/dist/components/Typography/Text.js +43 -0
- package/dist/components/Typography/Text.js.map +1 -0
- package/dist/components/Typography/Typography.module.css +132 -0
- package/dist/foundations/index.css +3 -0
- package/dist/foundations/layout.css +78 -0
- package/dist/foundations/tokens.css +236 -0
- package/dist/foundations/typography.css +49 -0
- package/dist/hooks/useDropdownPosition.d.ts +14 -0
- package/dist/hooks/useDropdownPosition.js +61 -0
- package/dist/hooks/useDropdownPosition.js.map +1 -0
- package/dist/hooks/useMediaQuery.d.ts +1 -0
- package/dist/hooks/useMediaQuery.js +33 -0
- package/dist/hooks/useMediaQuery.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/theme.d.ts +12 -0
- package/dist/theme.js +133 -0
- package/dist/theme.js.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/docs/README.md +40 -0
- package/docs/breadcrumbs.md +47 -0
- package/docs/card.md +18 -0
- package/docs/feedback.md +38 -0
- package/docs/forms.md +166 -0
- package/docs/layout.md +39 -0
- package/docs/navigation.md +80 -0
- package/docs/overlays.md +31 -0
- package/docs/pagination.md +50 -0
- package/docs/progress.md +18 -0
- package/docs/tabs.md +34 -0
- package/docs/theme.md +49 -0
- package/docs/typography.md +26 -0
- package/package.json +49 -0
package/docs/forms.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Forms
|
|
2
|
+
|
|
3
|
+
## Input
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Input>
|
|
7
|
+
<Input.Label>Email</Input.Label>
|
|
8
|
+
<Input.Field placeholder="name@example.com" />
|
|
9
|
+
</Input>
|
|
10
|
+
|
|
11
|
+
<Input>
|
|
12
|
+
<Input.Label>Ошибка</Input.Label>
|
|
13
|
+
<Input.Field hasError placeholder="Введите корректные данные" />
|
|
14
|
+
<Input.ErrorBag>Поле заполнено неверно.</Input.ErrorBag>
|
|
15
|
+
</Input>
|
|
16
|
+
|
|
17
|
+
<Input layout="row" labelWidth={140}>
|
|
18
|
+
<Input.Label>Телефон</Input.Label>
|
|
19
|
+
<Input.Field placeholder="+7 (___) ___‑__‑__" />
|
|
20
|
+
</Input>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Textarea
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Input>
|
|
27
|
+
<Input.Label>Комментарий</Input.Label>
|
|
28
|
+
<Input.TextArea placeholder="Текст..." />
|
|
29
|
+
</Input>
|
|
30
|
+
|
|
31
|
+
<Input layout="row" labelWidth={140}>
|
|
32
|
+
<Input.Label>Описание</Input.Label>
|
|
33
|
+
<Input.TextArea />
|
|
34
|
+
</Input>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Radio
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<Input.Radio name="mode" label="Основной" />
|
|
41
|
+
<Input.Radio name="mode" label="Резервный" />
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Switch
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<Input.Switch label="Автообновления" defaultChecked />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## FloatLabel
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
<Input>
|
|
54
|
+
<Input.FloatLabel label="Email">
|
|
55
|
+
<Input.Field name="email" />
|
|
56
|
+
</Input.FloatLabel>
|
|
57
|
+
</Input>
|
|
58
|
+
|
|
59
|
+
<Input>
|
|
60
|
+
<Input.FloatLabel label="Комментарий">
|
|
61
|
+
<Input.TextArea rows={4} />
|
|
62
|
+
</Input.FloatLabel>
|
|
63
|
+
</Input>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`FloatLabel` добавляет placeholder и прокидывает `hasError` в вложенное поле.
|
|
67
|
+
|
|
68
|
+
## Select
|
|
69
|
+
|
|
70
|
+
### Статический список
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
const options = [
|
|
74
|
+
{ value: 'dev', label: 'Development' },
|
|
75
|
+
{ value: 'prod', label: 'Production' },
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
<Input>
|
|
79
|
+
<Input.Label>Окружение</Input.Label>
|
|
80
|
+
<Input.Select options={options} />
|
|
81
|
+
</Input>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Поиск + multiple
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
<Input>
|
|
88
|
+
<Input.Label>Сервисы</Input.Label>
|
|
89
|
+
<Input.Select options={options} multiple searchable />
|
|
90
|
+
</Input>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Загрузка через axios
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<Input>
|
|
97
|
+
<Input.Label>Пользователь</Input.Label>
|
|
98
|
+
<Input.Select
|
|
99
|
+
request={{
|
|
100
|
+
url: '/api/users',
|
|
101
|
+
method: 'get',
|
|
102
|
+
mapOptions: (data) => data.items.map((item) => ({ value: item.id, label: item.name })),
|
|
103
|
+
}}
|
|
104
|
+
onAfterRequest={(options, query) => console.log(options, query)}
|
|
105
|
+
/>
|
|
106
|
+
</Input>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## MaskedInput
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<Input>
|
|
113
|
+
<Input.Label>Телефон</Input.Label>
|
|
114
|
+
<Input.MaskedInput mask="+7 (999) 999-99-99" />
|
|
115
|
+
</Input>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Number (money)
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<Input>
|
|
122
|
+
<Input.Label>Сумма</Input.Label>
|
|
123
|
+
<Input.Number placeholder="0.00" />
|
|
124
|
+
</Input>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Date / Time
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<Input>
|
|
131
|
+
<Input.Label>Дата</Input.Label>
|
|
132
|
+
<Input.DatePicker />
|
|
133
|
+
</Input>
|
|
134
|
+
|
|
135
|
+
<Input>
|
|
136
|
+
<Input.Label>Дата и время</Input.Label>
|
|
137
|
+
<Input.DatePicker withTime />
|
|
138
|
+
</Input>
|
|
139
|
+
|
|
140
|
+
<Input>
|
|
141
|
+
<Input.Label>Время</Input.Label>
|
|
142
|
+
<Input.TimePicker />
|
|
143
|
+
</Input>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Интервал дат
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
<Input>
|
|
150
|
+
<Input.Label>Период</Input.Label>
|
|
151
|
+
<Input.DateRange />
|
|
152
|
+
</Input>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## InputGroup
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
<Input>
|
|
159
|
+
<Input.Label>Цена</Input.Label>
|
|
160
|
+
<Input.Group stretch>
|
|
161
|
+
<Input.Addon>₽</Input.Addon>
|
|
162
|
+
<Input.Number placeholder="0.00" />
|
|
163
|
+
<Button appearance="outline">OK</Button>
|
|
164
|
+
</Input.Group>
|
|
165
|
+
</Input>
|
|
166
|
+
```
|
package/docs/layout.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Layout
|
|
2
|
+
|
|
3
|
+
## Grid
|
|
4
|
+
|
|
5
|
+
`Grid` — базовая сетка с CSS‑переменными. На брейкпоинтах можно менять колонки.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Grid columns={12} columnsLg={8} columnsMd={4} columnsSm={1} gap="16px">
|
|
9
|
+
<div>One</div>
|
|
10
|
+
<div>Two</div>
|
|
11
|
+
</Grid>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Параметры:
|
|
15
|
+
- `columns` — количество колонок
|
|
16
|
+
- `columnsLg`, `columnsMd`, `columnsSm` — колонки на 1280/1024/720px
|
|
17
|
+
- `gap` — расстояние между колонками
|
|
18
|
+
- `minWidth` — минимальная ширина колонки
|
|
19
|
+
|
|
20
|
+
## Row / Stack
|
|
21
|
+
|
|
22
|
+
`Row` — горизонтальный flex, `Stack` — вертикальный flex.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<Row gap="12px" wrap="wrap">
|
|
26
|
+
<div>A</div>
|
|
27
|
+
<div>B</div>
|
|
28
|
+
</Row>
|
|
29
|
+
|
|
30
|
+
<Stack gap="12px">
|
|
31
|
+
<div>Item</div>
|
|
32
|
+
<div>Item</div>
|
|
33
|
+
</Stack>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Параметры:
|
|
37
|
+
- `gap` — шаг между элементами
|
|
38
|
+
- `align`, `justify` — соответствуют flex‑свойствам
|
|
39
|
+
- `wrap` — управление переносом для `Row`
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Navigation
|
|
2
|
+
|
|
3
|
+
## Menu
|
|
4
|
+
|
|
5
|
+
`Menu` — единый компонент для вертикальных и горизонтальных меню.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
const items = [
|
|
9
|
+
{ label: 'Главная', href: '/' },
|
|
10
|
+
{ label: 'Документы', href: '/docs' },
|
|
11
|
+
{ divider: true },
|
|
12
|
+
{ label: 'Настройки', href: '/settings' },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
<Menu items={items} />
|
|
16
|
+
<Menu items={items} orientation="horizontal" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Кастомный компонент ссылок
|
|
20
|
+
|
|
21
|
+
По умолчанию используется `<a href>`. Если нужен `Link` (например, из Inertia/Next/React Router),
|
|
22
|
+
передайте его через `as` или укажите `as` у конкретного пункта.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Link } from '@inertiajs/react';
|
|
26
|
+
|
|
27
|
+
<Menu items={items} as={Link} />
|
|
28
|
+
|
|
29
|
+
const customItems = [
|
|
30
|
+
{ label: 'Главная', href: '/', as: Link },
|
|
31
|
+
{ label: 'Документы', href: '/docs' },
|
|
32
|
+
];
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Collapsible (vertical)
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
const groups = [
|
|
39
|
+
{
|
|
40
|
+
label: 'Сервисы',
|
|
41
|
+
open: true,
|
|
42
|
+
children: [{ label: 'Database' }, { label: 'Cache' }],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
<Menu items={groups} />
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Dropdown (horizontal)
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
const topMenu = [
|
|
53
|
+
{ label: 'Главная', href: '/' },
|
|
54
|
+
{ label: 'Команда', children: [{ label: 'Участники' }, { label: 'Роли' }] },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
<Menu items={topMenu} orientation="horizontal" />
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
В `MenuItem` можно указать `align: 'left' | 'right'` для выравнивания dropdown‑меню.
|
|
61
|
+
|
|
62
|
+
## Dropdown
|
|
63
|
+
|
|
64
|
+
Отдельный dropdown‑компонент, если нужен произвольный триггер.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<Dropdown trigger={<span>Открыть</span>} items={items} orientation="vertical" align="left" />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## CollapseButton
|
|
71
|
+
|
|
72
|
+
Универсальная кнопка для коллапса/бургер‑меню.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
<CollapseButton targetId="filters-panel" open={open} onClick={() => setOpen((v) => !v)}>
|
|
76
|
+
Фильтры
|
|
77
|
+
</CollapseButton>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Варианты: `burger` или `chevron`.
|
package/docs/overlays.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Overlays
|
|
2
|
+
|
|
3
|
+
## Modal
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Modal open={open} title="Заголовок" onClose={() => setOpen(false)}>
|
|
7
|
+
Контент модалки
|
|
8
|
+
</Modal>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Поддерживает `footer` для действий.
|
|
12
|
+
|
|
13
|
+
## Drawer
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Drawer open={open} title="Меню" position="left" onClose={() => setOpen(false)}>
|
|
17
|
+
Контент шторки
|
|
18
|
+
</Drawer>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`position` может быть `left` или `right`.
|
|
22
|
+
|
|
23
|
+
### Inline режим
|
|
24
|
+
|
|
25
|
+
Если нужен «постоянный» сайдбар:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Drawer open mode="inline" position="left" showHeader={false} showClose={false}>
|
|
29
|
+
Контент навигации
|
|
30
|
+
</Drawer>
|
|
31
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
`Pagination` — компонент навигации по страницам, совместимый с `links/meta` из бекенд‑пагинатора.
|
|
4
|
+
|
|
5
|
+
## Базовое использование
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
const pagination = {
|
|
9
|
+
links: {
|
|
10
|
+
first: 'https://api.local/users?page=1',
|
|
11
|
+
last: 'https://api.local/users?page=5',
|
|
12
|
+
prev: null,
|
|
13
|
+
next: 'https://api.local/users?page=2',
|
|
14
|
+
},
|
|
15
|
+
meta: {
|
|
16
|
+
current_page: 1,
|
|
17
|
+
last_page: 5,
|
|
18
|
+
per_page: 15,
|
|
19
|
+
total: 70,
|
|
20
|
+
from: 1,
|
|
21
|
+
to: 15,
|
|
22
|
+
path: 'https://api.local/users',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
<Pagination meta={pagination.meta} links={pagination.links} />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Управление навигацией вручную
|
|
30
|
+
|
|
31
|
+
Если нужен контроль над переходом (например, через Inertia), используйте `onNavigate`.
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
<Pagination
|
|
35
|
+
meta={pagination.meta}
|
|
36
|
+
links={pagination.links}
|
|
37
|
+
onNavigate={(page, url) => {
|
|
38
|
+
// Можно отправить запрос или обновить состояние
|
|
39
|
+
console.log(page, url);
|
|
40
|
+
}}
|
|
41
|
+
/>;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Полезные параметры
|
|
45
|
+
|
|
46
|
+
- `window` — количество страниц вокруг текущей.
|
|
47
|
+
- `showEdges` — показывать первую/последнюю страницу.
|
|
48
|
+
- `showInfo` — показывать текст `from–to из total`.
|
|
49
|
+
- `pageParam` — имя query‑параметра, по умолчанию `page`.
|
|
50
|
+
- `buildUrl` — собственный способ собрать URL.
|
package/docs/progress.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Progress
|
|
2
|
+
|
|
3
|
+
`Progress` — индикатор выполнения задач.
|
|
4
|
+
|
|
5
|
+
## Примеры
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Progress value={40} label="Миграции" />
|
|
9
|
+
<Progress value={72} label="Сборка" variant="primary" />
|
|
10
|
+
<Progress value={88} label="Тесты" variant="info" showValue />
|
|
11
|
+
<Progress label="Синхронизация" indeterminate />
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Варианты
|
|
15
|
+
|
|
16
|
+
- `variant`: `default`, `primary`, `info`, `success`, `warning`, `danger`.
|
|
17
|
+
- `size`: `sm`, `md`, `lg`.
|
|
18
|
+
- `indeterminate`: бесконечная анимация, без значения.
|
package/docs/tabs.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
`Tabs` — переключатель контентных панелей. Поддерживает горизонтальное и вертикальное расположение.
|
|
4
|
+
|
|
5
|
+
## Базовое использование
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
const items = [
|
|
9
|
+
{ id: 'overview', label: 'Обзор', content: 'Основная информация' },
|
|
10
|
+
{ id: 'metrics', label: 'Метрики', content: 'Графики и показатели' },
|
|
11
|
+
{ id: 'settings', label: 'Настройки', content: 'Скоро', disabled: true },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
<Tabs items={items} />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Управляемое состояние
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
const [activeId, setActiveId] = useState('overview');
|
|
21
|
+
|
|
22
|
+
<Tabs items={items} activeId={activeId} onChange={setActiveId} />;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Вертикальная ориентация
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Tabs items={items} orientation="vertical" />;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Дополнительно
|
|
32
|
+
|
|
33
|
+
- `badge` — дополнительная метка справа (например, `<Badge variant="info">3</Badge>`).
|
|
34
|
+
- `defaultActiveId` — активная вкладка по умолчанию (uncontrolled).
|
package/docs/theme.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Theme
|
|
2
|
+
|
|
3
|
+
ReactSoftBox поддерживает светлую, темную и системную темы, а также режим `auto` (днем светлая, вечером темная).
|
|
4
|
+
|
|
5
|
+
## Быстрый старт
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { initTheme } from '@phpsoftbox/react-softbox';
|
|
9
|
+
|
|
10
|
+
initTheme({ defaultMode: 'system' });
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Смена темы
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { setThemeMode } from '@phpsoftbox/react-softbox';
|
|
17
|
+
|
|
18
|
+
setThemeMode('light');
|
|
19
|
+
setThemeMode('dark');
|
|
20
|
+
setThemeMode('system');
|
|
21
|
+
setThemeMode('auto');
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Настройка auto‑режима
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
setThemeMode('auto', {
|
|
28
|
+
autoStartHour: 7, // с 07:00 светлая
|
|
29
|
+
autoEndHour: 19, // с 19:00 темная
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Хранение выбора
|
|
34
|
+
|
|
35
|
+
По умолчанию режим сохраняется в `localStorage` по ключу `psb-theme-mode`.
|
|
36
|
+
Можно переопределить:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
initTheme({ storageKey: 'my-app-theme' });
|
|
40
|
+
setThemeMode('dark', { storageKey: 'my-app-theme' });
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CSS‑переключение без JS
|
|
44
|
+
|
|
45
|
+
Если нужно вручную переключать тему без JS, можно выставить атрибут:
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<html data-theme="light"></html>
|
|
49
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Typography
|
|
2
|
+
|
|
3
|
+
Компоненты для текста и заголовков с единым набором цветовых вариантов.
|
|
4
|
+
|
|
5
|
+
## Heading
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
<Heading level={1}>Dashboard</Heading>
|
|
9
|
+
<Heading level={2} variant="primary">Сводка</Heading>
|
|
10
|
+
<Heading level={4} muted>Вспомогательный заголовок</Heading>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Text
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Text>Базовый текст</Text>
|
|
17
|
+
<Text size="sm" muted>Подпись</Text>
|
|
18
|
+
<Text weight="semibold">Полужирный</Text>
|
|
19
|
+
<Text italic>Курсив</Text>
|
|
20
|
+
<Text underline>Подчеркнутый</Text>
|
|
21
|
+
<Text strike>Зачеркнутый</Text>
|
|
22
|
+
<Text code>npm run dev</Text>
|
|
23
|
+
<Text variant="warning">Предупреждение</Text>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Поддерживаемые варианты: `default`, `primary`, `info`, `success`, `warning`, `danger`.
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@phpsoftbox/react-softbox",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"docs"
|
|
13
|
+
],
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"**/*.css"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./theme": {
|
|
23
|
+
"types": "./dist/theme.d.ts",
|
|
24
|
+
"import": "./dist/theme.js"
|
|
25
|
+
},
|
|
26
|
+
"./types": {
|
|
27
|
+
"types": "./dist/types.d.ts",
|
|
28
|
+
"import": "./dist/types.js"
|
|
29
|
+
},
|
|
30
|
+
"./foundations/index.css": "./dist/foundations/index.css"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"build": "tsc -p tsconfig.build.json && node scripts/copy-css.mjs",
|
|
35
|
+
"prepublishOnly": "yarn clean && yarn build"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^19.0.0",
|
|
39
|
+
"react-dom": "^19.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"axios": "^1.12.2"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/react": "^19.2.0",
|
|
46
|
+
"@types/react-dom": "^19.2.0",
|
|
47
|
+
"typescript": "^5.9.3"
|
|
48
|
+
}
|
|
49
|
+
}
|