@phpsoftbox/react-softbox 0.3.0 → 0.4.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/README.md +81 -1
- package/dist/components/Badge/Badge.d.ts +3 -1
- package/dist/components/Badge/Badge.js +7 -2
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Badge/Badge.module.css +18 -0
- package/dist/components/Input/ErrorTooltip/ErrorTooltip.d.ts +12 -0
- package/dist/components/Input/ErrorTooltip/ErrorTooltip.js +25 -0
- package/dist/components/Input/ErrorTooltip/ErrorTooltip.js.map +1 -0
- package/dist/components/Input/ErrorTooltip/ErrorTooltip.module.css +31 -0
- package/dist/components/Input/Field.js +8 -1
- package/dist/components/Input/Field.js.map +1 -1
- package/dist/components/Input/FloatLabel/FloatLabel.module.css +5 -3
- package/dist/components/Input/FormField/FormField.d.ts +2 -0
- package/dist/components/Input/FormField/FormField.js +12 -1
- package/dist/components/Input/FormField/FormField.js.map +1 -1
- package/dist/components/Input/FormField/FormField.module.css +1 -0
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Input/Input.js +2 -0
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.module.css +8 -1
- package/dist/components/Input/Select/Select.d.ts +52 -13
- package/dist/components/Input/Select/Select.js +103 -25
- package/dist/components/Input/Select/Select.js.map +1 -1
- package/dist/components/Input/Select/Select.module.css +65 -23
- package/dist/components/Modal/Modal.d.ts +2 -1
- package/dist/components/Modal/Modal.js +18 -1
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Table/Table.d.ts +26 -0
- package/dist/components/Table/Table.js +133 -91
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.module.css +41 -1
- package/dist/components/Tabs/Tabs.js +7 -6
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +33 -0
- package/dist/components/Tooltip/Tooltip.js +294 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.module.css +124 -0
- package/dist/foundations/index.css +1 -0
- package/dist/{components/Tabs/Tabs.module.css → foundations/tabs.css} +14 -11
- package/dist/foundations/tokens.css +6 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/docs/README.md +2 -0
- package/docs/feedback.md +3 -0
- package/docs/forms.md +55 -0
- package/docs/overlays.md +2 -2
- package/docs/table.md +137 -0
- package/docs/tabs.md +17 -0
- package/docs/tooltip.md +68 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,39 @@ import '@phpsoftbox/react-softbox/foundations/index.css';
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
Alert,
|
|
14
|
+
Badge,
|
|
15
|
+
Breadcrumbs,
|
|
16
|
+
Button,
|
|
17
|
+
Card,
|
|
18
|
+
Checkbox,
|
|
19
|
+
CollapseButton,
|
|
20
|
+
Drawer,
|
|
21
|
+
Dropdown,
|
|
22
|
+
FileUploader,
|
|
23
|
+
FloatLabel,
|
|
24
|
+
FormField,
|
|
25
|
+
Grid,
|
|
26
|
+
Heading,
|
|
27
|
+
Image,
|
|
28
|
+
Input,
|
|
29
|
+
Menu,
|
|
30
|
+
Modal,
|
|
31
|
+
Notifier,
|
|
32
|
+
Pagination,
|
|
33
|
+
Progress,
|
|
34
|
+
Radio,
|
|
35
|
+
Row,
|
|
36
|
+
Select,
|
|
37
|
+
Stack,
|
|
38
|
+
Switch,
|
|
39
|
+
Table,
|
|
40
|
+
Tabs,
|
|
41
|
+
Text,
|
|
42
|
+
Textarea,
|
|
43
|
+
Tooltip,
|
|
44
|
+
} from '@phpsoftbox/react-softbox';
|
|
13
45
|
```
|
|
14
46
|
|
|
15
47
|
## Тема
|
|
@@ -27,6 +59,8 @@ setThemeMode('dark');
|
|
|
27
59
|
- `docs/layout.md`
|
|
28
60
|
- `docs/navigation.md`
|
|
29
61
|
- `docs/forms.md`
|
|
62
|
+
- `docs/table.md`
|
|
63
|
+
- `docs/tooltip.md`
|
|
30
64
|
- `docs/overlays.md`
|
|
31
65
|
- `docs/feedback.md`
|
|
32
66
|
- `docs/card.md`
|
|
@@ -62,6 +96,7 @@ yarn build
|
|
|
62
96
|
<Button variant="primary">Primary</Button>
|
|
63
97
|
<Button variant="info" appearance="outline">Info</Button>
|
|
64
98
|
<Button variant="danger" appearance="ghost">Danger</Button>
|
|
99
|
+
<Button variant="primary" size="sm">Small</Button>
|
|
65
100
|
```
|
|
66
101
|
|
|
67
102
|
### Input / FloatLabel
|
|
@@ -84,6 +119,7 @@ yarn build
|
|
|
84
119
|
```tsx
|
|
85
120
|
<Textarea placeholder="Комментарий" />
|
|
86
121
|
<Radio name="mode" label="Основной" />
|
|
122
|
+
<Checkbox label="Согласен с условиями" />
|
|
87
123
|
```
|
|
88
124
|
|
|
89
125
|
### Switch
|
|
@@ -99,6 +135,50 @@ yarn build
|
|
|
99
135
|
<Select label="Сервисы" options={options} multiple searchable />
|
|
100
136
|
```
|
|
101
137
|
|
|
138
|
+
### Table
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
const columns = [
|
|
142
|
+
{ id: 'name', header: 'Название', accessor: 'name' },
|
|
143
|
+
{ id: 'amount', header: 'Сумма', accessor: 'amount', align: 'right', sortable: true },
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
<Table columns={columns} data={rows} />;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<Table
|
|
151
|
+
columns={columns}
|
|
152
|
+
data={rows}
|
|
153
|
+
selection={{
|
|
154
|
+
selectedIds,
|
|
155
|
+
onToggle: (id) => setSelected((prev) => prev.includes(id) ? prev.filter((key) => key !== id) : [...prev, id]),
|
|
156
|
+
onToggleAll: (ids) => setSelected((prev) => ids.length > 0 && ids.every((id) => prev.includes(id)) ? [] : ids),
|
|
157
|
+
}}
|
|
158
|
+
renderBulkAction={(ids) => <span>Выбрано: {ids.length}</span>}
|
|
159
|
+
/>;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### FileUploader
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
<FileUploader
|
|
166
|
+
allowedTypes={['.jpg', '.png', '.pdf']}
|
|
167
|
+
maxFileSizeKb={2048}
|
|
168
|
+
multiple
|
|
169
|
+
showPreview
|
|
170
|
+
onUpload={(files) => api.upload(files)}
|
|
171
|
+
/>;
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Tooltip
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<Tooltip content="Подсказка">
|
|
178
|
+
<Button>Наведи</Button>
|
|
179
|
+
</Tooltip>
|
|
180
|
+
```
|
|
181
|
+
|
|
102
182
|
### Grid / Flex
|
|
103
183
|
|
|
104
184
|
```tsx
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { UiVariant } from '../../types';
|
|
3
3
|
type BadgeVariant = UiVariant;
|
|
4
|
+
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
4
5
|
type Props = React.HTMLAttributes<HTMLSpanElement> & {
|
|
5
6
|
variant?: BadgeVariant;
|
|
7
|
+
size?: BadgeSize;
|
|
6
8
|
};
|
|
7
|
-
export default function Badge({ variant, className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function Badge({ variant, size, className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -8,8 +8,13 @@ const classMap = {
|
|
|
8
8
|
warning: styles.warning,
|
|
9
9
|
danger: styles.danger,
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const sizeMap = {
|
|
12
|
+
sm: styles.sizeSm,
|
|
13
|
+
md: styles.sizeMd,
|
|
14
|
+
lg: styles.sizeLg,
|
|
15
|
+
};
|
|
16
|
+
export default function Badge({ variant = 'default', size = 'md', className, ...props }) {
|
|
17
|
+
const classes = [styles.badge, classMap[variant], sizeMap[size], className].filter(Boolean).join(' ');
|
|
13
18
|
return _jsx("span", { className: classes, ...props });
|
|
14
19
|
}
|
|
15
20
|
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAWxC,MAAM,QAAQ,GAAiC;IAC7C,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CAAC;AAEF,MAAM,OAAO,GAA8B;IACzC,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,EAAE,EAAE,MAAM,CAAC,MAAM;IACjB,EAAE,EAAE,MAAM,CAAC,MAAM;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAS;IAC5F,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtG,OAAO,eAAM,SAAS,EAAE,OAAO,KAAM,KAAK,GAAI,CAAC;AACjD,CAAC"}
|
|
@@ -5,11 +5,29 @@
|
|
|
5
5
|
padding: 4px 10px;
|
|
6
6
|
border-radius: 999px;
|
|
7
7
|
font-size: 12px;
|
|
8
|
+
line-height: 1;
|
|
8
9
|
letter-spacing: 0.08em;
|
|
9
10
|
text-transform: uppercase;
|
|
10
11
|
border: 1px solid transparent;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
.sizeSm {
|
|
15
|
+
padding: 2px 8px;
|
|
16
|
+
font-size: 10px;
|
|
17
|
+
letter-spacing: 0.1em;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sizeMd {
|
|
21
|
+
padding: 4px 10px;
|
|
22
|
+
font-size: 12px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.sizeLg {
|
|
26
|
+
padding: 6px 12px;
|
|
27
|
+
font-size: 13px;
|
|
28
|
+
letter-spacing: 0.07em;
|
|
29
|
+
}
|
|
30
|
+
|
|
13
31
|
.default {
|
|
14
32
|
background: var(--badge-default-bg, #1e3355);
|
|
15
33
|
color: var(--badge-default-color, var(--color-muted));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type TooltipPlacement, type TooltipVariant } from '../../Tooltip/Tooltip';
|
|
3
|
+
type Props = {
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
placement?: TooltipPlacement;
|
|
6
|
+
variant?: TooltipVariant;
|
|
7
|
+
target?: 'icon' | 'input';
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function ErrorTooltip({ content, placement, variant, target, icon, className, }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Tooltip from '../../Tooltip/Tooltip';
|
|
4
|
+
import { useFormFieldContext } from '../FormField/FormField';
|
|
5
|
+
import styles from './ErrorTooltip.module.css';
|
|
6
|
+
export default function ErrorTooltip({ content, placement = 'right', variant = 'danger', target = 'icon', icon = '!', className, }) {
|
|
7
|
+
const context = useFormFieldContext();
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
if (target !== 'icon') {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!context?.registerErrorTooltip) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
return context.registerErrorTooltip();
|
|
16
|
+
}, [context, target]);
|
|
17
|
+
if (target === 'input') {
|
|
18
|
+
if (!context?.fieldId) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (_jsx(Tooltip, { content: content, placement: placement, variant: variant, anchorId: context.fieldId, openOnHover: true, openOnFocus: true }));
|
|
22
|
+
}
|
|
23
|
+
return (_jsx(Tooltip, { content: content, placement: placement, variant: variant, openOnHover: true, openOnFocus: true, children: _jsx("button", { type: "button", className: [styles.icon, styles.iconButton, className].filter(Boolean).join(' '), "aria-label": "\u041E\u0448\u0438\u0431\u043A\u0430", children: icon }) }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ErrorTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorTooltip.js","sourceRoot":"","sources":["../../../../src/components/Input/ErrorTooltip/ErrorTooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAuD,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAW/C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,OAAO,EACP,SAAS,GAAG,OAAO,EACnB,OAAO,GAAG,QAAQ,EAClB,MAAM,GAAG,MAAM,EACf,IAAI,GAAG,GAAG,EACV,SAAS,GACH;IACN,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IAEtC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QACD,OAAO,OAAO,CAAC,oBAAoB,EAAE,CAAC;IACxC,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAEtB,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CACL,KAAC,OAAO,IACN,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO,CAAC,OAAO,EACzB,WAAW,QACX,WAAW,SACX,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,OAAO,IAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,QAAC,WAAW,kBACxF,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAa,sCAAQ,YACxH,IAAI,GACE,GACD,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.icon {
|
|
2
|
+
position: absolute;
|
|
3
|
+
right: 12px;
|
|
4
|
+
top: 50%;
|
|
5
|
+
transform: translateY(-50%);
|
|
6
|
+
width: 18px;
|
|
7
|
+
height: 18px;
|
|
8
|
+
border-radius: 999px;
|
|
9
|
+
background: rgba(255, 107, 107, 0.16);
|
|
10
|
+
border: 1px solid rgba(255, 107, 107, 0.6);
|
|
11
|
+
color: #ff8f8f;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
font-weight: 700;
|
|
17
|
+
line-height: 1;
|
|
18
|
+
pointer-events: auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.iconButton {
|
|
22
|
+
border: none;
|
|
23
|
+
background: transparent;
|
|
24
|
+
padding: 0;
|
|
25
|
+
margin: 0;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.content {
|
|
30
|
+
max-width: 240px;
|
|
31
|
+
}
|
|
@@ -8,7 +8,14 @@ const InputField = React.forwardRef(({ hasError, className, ...props }, ref) =>
|
|
|
8
8
|
const generatedId = React.useId();
|
|
9
9
|
const resolvedId = props.id ?? context?.fieldId ?? (props.name ? buildIdFromName(props.name) : generatedId);
|
|
10
10
|
const autoComplete = props.autoComplete ?? 'off';
|
|
11
|
-
const classes = [
|
|
11
|
+
const classes = [
|
|
12
|
+
styles.input,
|
|
13
|
+
hasError ? styles.error : null,
|
|
14
|
+
context?.hasErrorTooltip ? styles.withErrorTooltip : null,
|
|
15
|
+
className,
|
|
16
|
+
]
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.join(' ');
|
|
12
19
|
if (process.env.NODE_ENV !== 'production') {
|
|
13
20
|
if (!props.id && !props.name) {
|
|
14
21
|
// eslint-disable-next-line no-console
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../src/components/Input/Field.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAM5D,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE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|
+
font-size: var(--ui-control-font-size, var(--font-size-3));
|
|
12
|
+
line-height: 1.2;
|
|
12
13
|
letter-spacing: 0.02em;
|
|
13
14
|
transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease;
|
|
14
15
|
pointer-events: none;
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
|
|
51
52
|
.wrapper > input,
|
|
52
53
|
.wrapper > textarea {
|
|
53
|
-
|
|
54
|
-
padding-
|
|
54
|
+
min-height: var(--ui-control-height, 48px);
|
|
55
|
+
padding-top: calc(var(--ui-control-padding-y, 12px) + 6px);
|
|
56
|
+
padding-bottom: calc(var(--ui-control-padding-y, 12px) - 2px);
|
|
55
57
|
}
|
|
@@ -23,6 +23,8 @@ type FormFieldContextValue = {
|
|
|
23
23
|
fieldId?: string;
|
|
24
24
|
fieldName?: string;
|
|
25
25
|
registerField: (id: string, name?: string) => void;
|
|
26
|
+
registerErrorTooltip?: () => () => void;
|
|
27
|
+
hasErrorTooltip?: boolean;
|
|
26
28
|
};
|
|
27
29
|
export declare const useFormFieldContext: () => FormFieldContextValue | null;
|
|
28
30
|
declare const FormField: FormFieldComponent;
|
|
@@ -16,12 +16,17 @@ const labelAlignMap = {
|
|
|
16
16
|
function FormFieldRoot({ layout = 'column', gap = '8px', labelWidth, align = 'start', labelAlign = 'left', className, style, ...props }) {
|
|
17
17
|
const [fieldId, setFieldId] = React.useState(undefined);
|
|
18
18
|
const [fieldName, setFieldName] = React.useState(undefined);
|
|
19
|
+
const [errorTooltipCount, setErrorTooltipCount] = React.useState(0);
|
|
19
20
|
const registerField = React.useCallback((id, name) => {
|
|
20
21
|
setFieldId(id);
|
|
21
22
|
if (name) {
|
|
22
23
|
setFieldName(name);
|
|
23
24
|
}
|
|
24
25
|
}, []);
|
|
26
|
+
const registerErrorTooltip = React.useCallback(() => {
|
|
27
|
+
setErrorTooltipCount((prev) => prev + 1);
|
|
28
|
+
return () => setErrorTooltipCount((prev) => Math.max(prev - 1, 0));
|
|
29
|
+
}, []);
|
|
25
30
|
const classes = [styles.field, layout === 'row' ? styles.fieldRow : null, className]
|
|
26
31
|
.filter(Boolean)
|
|
27
32
|
.join(' ');
|
|
@@ -32,7 +37,13 @@ function FormFieldRoot({ layout = 'column', gap = '8px', labelWidth, align = 'st
|
|
|
32
37
|
['--ui-field-align']: alignMap[align],
|
|
33
38
|
['--ui-label-align']: labelAlignMap[labelAlign],
|
|
34
39
|
};
|
|
35
|
-
return (_jsx(FormFieldContext.Provider, { value: {
|
|
40
|
+
return (_jsx(FormFieldContext.Provider, { value: {
|
|
41
|
+
fieldId,
|
|
42
|
+
fieldName,
|
|
43
|
+
registerField,
|
|
44
|
+
registerErrorTooltip,
|
|
45
|
+
hasErrorTooltip: errorTooltipCount > 0,
|
|
46
|
+
}, children: _jsx("div", { className: classes, style: inlineStyle, ...props }) }));
|
|
36
47
|
}
|
|
37
48
|
function FormFieldLabel({ className, ...props }) {
|
|
38
49
|
const context = useFormFieldContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../../src/components/Input/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"FormField.js","sourceRoot":"","sources":["../../../../src/components/Input/FormField/FormField.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAoC5C,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAA+B,IAAI,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAE5E,MAAM,QAAQ,GAA0B;IACtC,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,UAAU;CA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AAI,CAAC;AACpE,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAgB;IAC7D,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtE,OAAO,cAAK,SAAS,EAAE,OAAO,KAAM,KAAK,GAAI,CAAC;AAChD,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAc;IACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpE,OAAO,CACL,cAAK,SAAS,EAAE,OAAO,EAAE,IAAI,EAAC,OAAO,KAAK,KAAK,YAC5C,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE;IAC7C,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,gBAAgB;IACzB,QAAQ,EAAE,cAAc;CACzB,CAAuB,CAAC;AAEzB,eAAe,SAAS,CAAC"}
|
|
@@ -10,6 +10,7 @@ import DateRangePicker from './DateRangePicker';
|
|
|
10
10
|
import Radio from './Radio/Radio';
|
|
11
11
|
import Switch from './Switch/Switch';
|
|
12
12
|
import Checkbox from './Checkbox/Checkbox';
|
|
13
|
+
import ErrorTooltip from './ErrorTooltip/ErrorTooltip';
|
|
13
14
|
declare const Input: import("react").FC<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
14
15
|
layout?: "row" | "column";
|
|
15
16
|
gap?: number | string;
|
|
@@ -44,6 +45,7 @@ declare const Input: import("react").FC<import("react").HTMLAttributes<HTMLDivEl
|
|
|
44
45
|
Radio: typeof Radio;
|
|
45
46
|
Switch: typeof Switch;
|
|
46
47
|
Checkbox: typeof Checkbox;
|
|
48
|
+
ErrorTooltip: typeof ErrorTooltip;
|
|
47
49
|
FormField: import("react").FC<import("react").HTMLAttributes<HTMLDivElement> & {
|
|
48
50
|
layout?: "row" | "column";
|
|
49
51
|
gap?: number | string;
|
|
@@ -12,6 +12,7 @@ import DateRangePicker from './DateRangePicker';
|
|
|
12
12
|
import Radio from './Radio/Radio';
|
|
13
13
|
import Switch from './Switch/Switch';
|
|
14
14
|
import Checkbox from './Checkbox/Checkbox';
|
|
15
|
+
import ErrorTooltip from './ErrorTooltip/ErrorTooltip';
|
|
15
16
|
const Input = Object.assign(FormField, {
|
|
16
17
|
Label: FormField.Label,
|
|
17
18
|
Control: FormField.Control,
|
|
@@ -30,6 +31,7 @@ const Input = Object.assign(FormField, {
|
|
|
30
31
|
Radio,
|
|
31
32
|
Switch,
|
|
32
33
|
Checkbox,
|
|
34
|
+
ErrorTooltip,
|
|
33
35
|
FormField,
|
|
34
36
|
});
|
|
35
37
|
export default Input;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD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;AAEH,eAAe,KAAK,CAAC"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
.input {
|
|
2
2
|
width: 100%;
|
|
3
|
-
|
|
3
|
+
min-height: var(--ui-control-height, 48px);
|
|
4
|
+
padding: var(--ui-control-padding-y, 12px) var(--ui-control-padding-x, 16px);
|
|
4
5
|
border-radius: var(--radius-sm);
|
|
5
6
|
border: 1px solid rgba(30, 99, 233, 0.25);
|
|
6
7
|
background: var(--surface-input);
|
|
7
8
|
color: var(--color-text);
|
|
9
|
+
font-size: var(--ui-control-font-size, var(--font-size-4));
|
|
10
|
+
line-height: var(--ui-control-line-height, 1.2);
|
|
8
11
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
9
12
|
}
|
|
10
13
|
|
|
14
|
+
.withErrorTooltip {
|
|
15
|
+
padding-right: calc(var(--ui-control-padding-x, 16px) + 26px);
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
.input:focus {
|
|
12
19
|
outline: none;
|
|
13
20
|
border-color: rgba(20, 201, 214, 0.8);
|
|
@@ -1,37 +1,76 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
1
|
+
export type SelectOptionValue = string | number | null;
|
|
2
|
+
export type SelectOption<T extends string | number = string | number> = {
|
|
3
|
+
value: T;
|
|
3
4
|
label: string;
|
|
4
5
|
disabled?: boolean;
|
|
5
6
|
};
|
|
6
|
-
type RequestConfig = {
|
|
7
|
+
type RequestConfig<T extends string | number = string | number> = {
|
|
7
8
|
url: string;
|
|
8
9
|
method?: 'get' | 'post';
|
|
9
10
|
params?: Record<string, unknown>;
|
|
10
11
|
data?: Record<string, unknown>;
|
|
11
|
-
mapOptions?: (data: unknown) => SelectOption[];
|
|
12
|
+
mapOptions?: (data: unknown) => SelectOption<T>[];
|
|
12
13
|
};
|
|
13
|
-
type
|
|
14
|
+
type SharedProps<T extends string | number> = {
|
|
14
15
|
label?: string;
|
|
15
16
|
id?: string;
|
|
16
17
|
name?: string;
|
|
17
|
-
options?: SelectOption[];
|
|
18
|
-
value?: string | string[];
|
|
19
|
-
defaultValue?: string | string[];
|
|
18
|
+
options?: SelectOption<T>[];
|
|
20
19
|
placeholder?: string;
|
|
21
20
|
multiple?: boolean;
|
|
22
21
|
searchable?: boolean;
|
|
22
|
+
clearable?: boolean;
|
|
23
|
+
clearLabel?: string;
|
|
24
|
+
allowEmptyValue?: boolean;
|
|
25
|
+
emptyOptionLabel?: string;
|
|
26
|
+
emptyOptionValue?: T | null;
|
|
23
27
|
loadingText?: string;
|
|
24
28
|
emptyText?: string;
|
|
25
|
-
loadOptions?: (query: string) => Promise<SelectOption[]>;
|
|
26
|
-
request?: RequestConfig
|
|
27
|
-
onAfterRequest?: (options: SelectOption[], query: string) => void;
|
|
29
|
+
loadOptions?: (query: string) => Promise<SelectOption<T>[]>;
|
|
30
|
+
request?: RequestConfig<T>;
|
|
31
|
+
onAfterRequest?: (options: SelectOption<T>[], query: string) => void;
|
|
28
32
|
placement?: 'auto' | 'down' | 'up';
|
|
29
33
|
disabled?: boolean;
|
|
30
34
|
floatLabel?: boolean;
|
|
31
35
|
className?: string;
|
|
32
|
-
onChange?: (value: string | string[], options: SelectOption[]) => void;
|
|
33
36
|
};
|
|
34
|
-
|
|
37
|
+
type SingleProps<T extends string | number> = SharedProps<T> & {
|
|
38
|
+
multiple?: false;
|
|
39
|
+
clearable?: false;
|
|
40
|
+
allowEmptyValue?: false;
|
|
41
|
+
value?: T;
|
|
42
|
+
defaultValue?: T;
|
|
43
|
+
onChange?: (value: T, options: SelectOption<T>[]) => void;
|
|
44
|
+
};
|
|
45
|
+
type SingleClearableProps<T extends string | number> = SharedProps<T> & {
|
|
46
|
+
multiple?: false;
|
|
47
|
+
clearable: true;
|
|
48
|
+
allowEmptyValue?: false;
|
|
49
|
+
value?: T | undefined;
|
|
50
|
+
defaultValue?: T | undefined;
|
|
51
|
+
onChange?: (value: T | undefined, options: SelectOption<T>[]) => void;
|
|
52
|
+
};
|
|
53
|
+
type SingleAllowEmptyProps<T extends string | number> = SharedProps<T> & {
|
|
54
|
+
multiple?: false;
|
|
55
|
+
allowEmptyValue: true;
|
|
56
|
+
clearable?: boolean;
|
|
57
|
+
value?: T | null | undefined;
|
|
58
|
+
defaultValue?: T | null | undefined;
|
|
59
|
+
emptyOptionValue?: T | null;
|
|
60
|
+
onChange?: (value: T | null | undefined, options: Array<SelectOption<T> | {
|
|
61
|
+
value: T | null;
|
|
62
|
+
label: string;
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
}>) => void;
|
|
65
|
+
};
|
|
66
|
+
type MultiProps<T extends string | number> = SharedProps<T> & {
|
|
67
|
+
multiple: true;
|
|
68
|
+
value?: T[];
|
|
69
|
+
defaultValue?: T[];
|
|
70
|
+
onChange?: (value: T[], options: SelectOption<T>[]) => void;
|
|
71
|
+
};
|
|
72
|
+
type Props<T extends string | number> = SingleProps<T> | SingleClearableProps<T> | SingleAllowEmptyProps<T> | MultiProps<T>;
|
|
73
|
+
declare function Select<T extends string | number = string | number>({ label, id, name, options, value, defaultValue, placeholder, multiple, searchable, clearable, clearLabel, allowEmptyValue, emptyOptionLabel, emptyOptionValue, loadingText, emptyText, loadOptions, request, onAfterRequest, placement, disabled, floatLabel, className, onChange, }: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
35
74
|
declare namespace Select {
|
|
36
75
|
var supportsFloatLabel: boolean;
|
|
37
76
|
}
|